Skip to content

Commit becc304

Browse files
Merge pull request #105 from linksplatform/feature/use_generic_math
[C#] 0.7.0
2 parents e2647ed + 59a920d commit becc304

17 files changed

+33
-1199
lines changed

csharp/Platform.Numbers.Benchmarks/ArithmeticBenchmarks.cs

Lines changed: 0 additions & 86 deletions
This file was deleted.

csharp/Platform.Numbers.Benchmarks/Program.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ namespace Platform.Numbers.Benchmarks
66
static class Program
77
{
88
static void Main() {
9-
//BenchmarkRunner.Run<ArithmeticBenchmarks>();
109
BenchmarkRunner.Run<MathBenchmarks>();
1110
}
1211
}

csharp/Platform.Numbers.Tests/ArithmeticExtensionsTests.cs

Lines changed: 0 additions & 25 deletions
This file was deleted.

csharp/Platform.Numbers.Tests/ArithmeticTests.cs

Lines changed: 0 additions & 20 deletions
This file was deleted.

csharp/Platform.Numbers.Tests/BitTests.cs

Lines changed: 6 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -16,50 +16,6 @@ public static void GetLowestBitPositionTest(ulong value, int expectedPosition)
1616
Assert.True(Bit.GetLowestPosition(value) == expectedPosition);
1717
}
1818

19-
[Fact]
20-
public static void ByteBitwiseOperationsTest()
21-
{
22-
Assert.True(Bit<byte>.Not(2) == unchecked((byte)~2));
23-
Assert.True(Bit<byte>.Or(1, 2) == (1 | 2));
24-
Assert.True(Bit<byte>.And(1, 2) == (1 & 2));
25-
Assert.True(Bit<byte>.ShiftLeft(1, 2) == (1 << 2));
26-
Assert.True(Bit<byte>.ShiftRight(1, 2) == (1 >> 2));
27-
Assert.Equal(NumericType<byte>.MaxValue >> 1, Bit<byte>.ShiftRight(NumericType<byte>.MaxValue, 1));
28-
}
29-
30-
[Fact]
31-
public static void UInt16BitwiseOperationsTest()
32-
{
33-
Assert.True(Bit<ushort>.Not(2) == unchecked((ushort)~2));
34-
Assert.True(Bit<ushort>.Or(1, 2) == (1 | 2));
35-
Assert.True(Bit<ushort>.And(1, 2) == (1 & 2));
36-
Assert.True(Bit<ushort>.ShiftLeft(1, 2) == (1 << 2));
37-
Assert.True(Bit<ushort>.ShiftRight(1, 2) == (1 >> 2));
38-
Assert.Equal(NumericType<ushort>.MaxValue >> 1, Bit<ushort>.ShiftRight(NumericType<ushort>.MaxValue, 1));
39-
}
40-
41-
[Fact]
42-
public static void UInt32BitwiseOperationsTest()
43-
{
44-
Assert.True(Bit<uint>.Not(2) == unchecked((uint)~2));
45-
Assert.True(Bit<uint>.Or(1, 2) == (1 | 2));
46-
Assert.True(Bit<uint>.And(1, 2) == (1 & 2));
47-
Assert.True(Bit<uint>.ShiftLeft(1, 2) == (1 << 2));
48-
Assert.True(Bit<uint>.ShiftRight(1, 2) == (1 >> 2));
49-
Assert.Equal(NumericType<uint>.MaxValue >> 1, Bit<uint>.ShiftRight(NumericType<uint>.MaxValue, 1));
50-
}
51-
52-
[Fact]
53-
public static void UInt64BitwiseOperationsTest()
54-
{
55-
Assert.True(Bit<ulong>.Not(2) == unchecked((ulong)~2));
56-
Assert.True(Bit<ulong>.Or(1, 2) == (1 | 2));
57-
Assert.True(Bit<ulong>.And(1, 2) == (1 & 2));
58-
Assert.True(Bit<ulong>.ShiftLeft(1, 2) == (1 << 2));
59-
Assert.True(Bit<ulong>.ShiftRight(1, 2) == (1 >> 2));
60-
Assert.Equal(NumericType<ulong>.MaxValue >> 1, Bit<ulong>.ShiftRight(NumericType<ulong>.MaxValue, 1));
61-
}
62-
6319
[Fact]
6420
public static void PartialReadWriteTest()
6521
{
@@ -104,17 +60,17 @@ public static void PartialReadWriteTest()
10460
Assert.True(secondValue == unpackagedSecondValue);
10561

10662
// Using universal functions:
107-
Assert.True(Bit.PartialRead(value, 0, 1) == firstValue);
108-
Assert.True(Bit.PartialRead(value, 1, -1) == secondValue);
63+
Assert.True(Bit<uint>.PartialRead(value, 0, 1) == firstValue);
64+
Assert.True(Bit<uint>.PartialRead(value, 1, -1) == secondValue);
10965

11066
firstValue = 0;
11167
secondValue = 6892;
11268

113-
value = Bit.PartialWrite(value, firstValue, 0, 1);
114-
value = Bit.PartialWrite(value, secondValue, 1, -1);
69+
value = Bit<uint>.PartialWrite(value, firstValue, 0, 1);
70+
value = Bit<uint>.PartialWrite(value, secondValue, 1, -1);
11571

116-
Assert.True(Bit.PartialRead(value, 0, 1) == firstValue);
117-
Assert.True(Bit.PartialRead(value, 1, -1) == secondValue);
72+
Assert.True(Bit<uint>.PartialRead(value, 0, 1) == firstValue);
73+
Assert.True(Bit<uint>.PartialRead(value, 1, -1) == secondValue);
11874
}
11975

12076
{

csharp/Platform.Numbers.Tests/MathExtensionsTests.cs

Lines changed: 0 additions & 34 deletions
This file was deleted.

csharp/Platform.Numbers.Tests/MathTests.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)