Skip to content

Commit 0c64fe7

Browse files
committed
-Fixed major bug in .Net 8.
1 parent efc121d commit 0c64fe7

File tree

4 files changed

+22
-46
lines changed

4 files changed

+22
-46
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,3 +399,4 @@ FodyWeavers.xsd
399399
/src/MissingValues/MathQ.MathFunctions.cs
400400
/src/MissingValues/Properties/MissingValues.AssemblyInfo.cs
401401
/src/MissingValues/Properties/AssemblyInfo.cs
402+
/src/MissingValues.Benchmarks/MissingValues.Benchmarks.csproj

src/MissingValues.Benchmarks/Program.cs

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,25 @@
1010
using System.Runtime.Intrinsics;
1111
using System.Windows.Markup;
1212

13-
BenchmarkRunner.Run(
14-
new Type[]
15-
{
16-
typeof(UInt256Benchmarks.MathOperators),
17-
typeof(UInt256Benchmarks.Formatting),
18-
typeof(UInt256Benchmarks.Parsing),
19-
typeof(UInt256Benchmarks.Operations),
20-
typeof(UInt512Benchmarks.MathOperators),
21-
typeof(UInt512Benchmarks.Formatting),
22-
typeof(UInt512Benchmarks.Parsing),
23-
typeof(UInt512Benchmarks.Operations),
24-
typeof(QuadBenchmarks.MathOperators),
25-
typeof(QuadBenchmarks.Parser),
26-
}
27-
);
13+
//BenchmarkRunner.Run(
14+
// new Type[]
15+
// {
16+
// typeof(UInt256Benchmarks.MathOperators),
17+
// typeof(UInt256Benchmarks.Formatting),
18+
// typeof(UInt256Benchmarks.Parsing),
19+
// typeof(UInt256Benchmarks.Operations),
20+
// typeof(UInt512Benchmarks.MathOperators),
21+
// typeof(UInt512Benchmarks.Formatting),
22+
// typeof(UInt512Benchmarks.Parsing),
23+
// typeof(UInt512Benchmarks.Operations),
24+
// typeof(QuadBenchmarks.MathOperators),
25+
// typeof(QuadBenchmarks.Parser),
26+
// }
27+
//);
2828

29+
//BenchmarkRunner.Run<QuadBenchmarks.MathOperators>();
30+
31+
UInt128 uInt = new UInt128(0xFFFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFF);
32+
33+
Console.WriteLine(uInt.GetUpperBits());
2934
Console.ReadLine();

src/MissingValues.Benchmarks/QuadBenchmarks.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using BenchmarkDotNet.Attributes;
2+
using BenchmarkDotNet.Jobs;
23
using System;
34
using System.Collections.Generic;
45
using System.Globalization;

src/MissingValues/Internals/BitHelper.cs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -25,37 +25,7 @@ public static void GetUpperAndLowerBits(Int128 value, out ulong upper, out ulong
2525
upper = value.GetUpperBits();
2626
}
2727

28-
#if NET8_0_OR_GREATER
29-
[UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_upper")]
30-
private static extern ref ulong GetUpperBitsInternal(UInt128 uInt128);
31-
[UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_lower")]
32-
private static extern ref ulong GetLowerBitsInternal(UInt128 uInt128);
33-
[UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_upper")]
34-
private static extern ref ulong GetUpperBitsInternal(Int128 int128);
35-
[UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_lower")]
36-
private static extern ref ulong GetLowerBitsInternal(Int128 int128);
3728

38-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
39-
public static ulong GetUpperBits(this in UInt128 value)
40-
{
41-
return GetUpperBitsInternal(value);
42-
}
43-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
44-
public static ulong GetUpperBits(this in Int128 value)
45-
{
46-
return GetUpperBitsInternal(value);
47-
}
48-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
49-
public static ulong GetLowerBits(this in UInt128 value)
50-
{
51-
return GetLowerBitsInternal(value);
52-
}
53-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
54-
public static ulong GetLowerBits(this in Int128 value)
55-
{
56-
return GetLowerBitsInternal(value);
57-
}
58-
#else
5929
[MethodImpl(MethodImplOptions.AggressiveInlining)]
6030
public static ulong GetUpperBits(this in UInt128 value)
6131
{
@@ -76,7 +46,6 @@ public static ulong GetLowerBits(this in Int128 value)
7646
{
7747
return unchecked((ulong)(value));
7848
}
79-
#endif
8049

8150
public static void GetDoubleParts(double dbl, out int sign, out int exp, out ulong man, out bool fFinite)
8251
{

0 commit comments

Comments
 (0)