Skip to content

Commit

Permalink
Simplify bNot and remove unused functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
OmegaExtern committed Aug 7, 2016
1 parent dda7fae commit 8b52301
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/bitwz/BitwiseNot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ public static partial class BitwzMath
/// <param name="value">An integer value.</param>
/// <returns>The result of the bitwise one's complement of <paramref name="value"/>.</returns>
/// <remarks>The bitwise one's complement operator reverses each bit in a numeric value. That is, bits in <paramref name="value"/> 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: <see cref="Properties.Resources.BitwiseNot"/>.</remarks>
public static int bNot(int value) => (int)tobit(MODM - mod(value, MOD));
public static int bNot(int value) => -1 - value;
}
}
27 changes: 0 additions & 27 deletions src/bitwz/BitwzMath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
//}

/// <summary>
/// Normalizes a number to the numeric range of bit operations.
/// </summary>
/// <param name="value">A number to be normalized.</param>
/// <returns>A value that has been normalized to the numeric range of bit operations.</returns>
private static long tobit(long value)
{
value = mod(value, MOD);
if (value < 0x80000000L)
{
return value;
}

return value - MOD;
}

/// <summary>
/// Computes the remainder after dividing its first operand by its second.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions src/bitwz/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
2 changes: 1 addition & 1 deletion tests/bitwz.Tests/BitwzMathTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 8b52301

Please sign in to comment.