From 8b523016bbfa5eca2fcdf99e9b4f52abdecfde81 Mon Sep 17 00:00:00 2001 From: OmegaExtern Date: Sun, 7 Aug 2016 12:21:34 +0200 Subject: [PATCH] Simplify bNot and remove unused functions. --- src/bitwz/BitwiseNot.cs | 2 +- src/bitwz/BitwzMath.cs | 27 --------------------------- src/bitwz/Properties/AssemblyInfo.cs | 4 ++-- tests/bitwz.Tests/BitwzMathTests.cs | 2 +- 4 files changed, 4 insertions(+), 31 deletions(-) diff --git a/src/bitwz/BitwiseNot.cs b/src/bitwz/BitwiseNot.cs index 4bc30fd..b79c029 100644 --- a/src/bitwz/BitwiseNot.cs +++ b/src/bitwz/BitwiseNot.cs @@ -8,6 +8,6 @@ public static partial class BitwzMath /// An integer value. /// The result of the bitwise one's complement of . /// The bitwise one's complement operator reverses each bit in a numeric value. That is, bits in that are 0 are set to 1 in the result, and bits that are 1 are set to 0 in the result. The following table illustrates the bitwise one's complement operation: . - public static int bNot(int value) => (int)tobit(MODM - mod(value, MOD)); + public static int bNot(int value) => -1 - value; } } \ No newline at end of file diff --git a/src/bitwz/BitwzMath.cs b/src/bitwz/BitwzMath.cs index a9d2561..c5cb462 100644 --- a/src/bitwz/BitwzMath.cs +++ b/src/bitwz/BitwzMath.cs @@ -56,33 +56,6 @@ static BitwzMath() // return l > d ? l - 1 : l; //} - // pow is not needed any more as it uses pre-compiled array (Pow2). - //private static int pow(int value, int y) - //{ - // int result = value; - // for (int i = y; i > 1; --i) - // { - // result *= value; - // } - // return result; - //} - - /// - /// Normalizes a number to the numeric range of bit operations. - /// - /// A number to be normalized. - /// A value that has been normalized to the numeric range of bit operations. - private static long tobit(long value) - { - value = mod(value, MOD); - if (value < 0x80000000L) - { - return value; - } - - return value - MOD; - } - /// /// Computes the remainder after dividing its first operand by its second. /// diff --git a/src/bitwz/Properties/AssemblyInfo.cs b/src/bitwz/Properties/AssemblyInfo.cs index 9a8d2ac..4628c00 100644 --- a/src/bitwz/Properties/AssemblyInfo.cs +++ b/src/bitwz/Properties/AssemblyInfo.cs @@ -32,6 +32,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.2.0.0")] +[assembly: AssemblyFileVersion("1.2.0.0")] [assembly: NeutralResourcesLanguage("en-US")] \ No newline at end of file diff --git a/tests/bitwz.Tests/BitwzMathTests.cs b/tests/bitwz.Tests/BitwzMathTests.cs index 62449dd..e41480a 100644 --- a/tests/bitwz.Tests/BitwzMathTests.cs +++ b/tests/bitwz.Tests/BitwzMathTests.cs @@ -17,7 +17,7 @@ namespace bitwz.Tests #endif public class BitwzMathTests { - private const double FloorDoubleDelta = 0.0004, FloorDoubleExpectedResult = -2500; + private const double FloorDoubleDelta = 0.0004, FloorDoubleExpectedResult = -2500.0; #if USE_MSUNIT [TestMethod]