Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Gekctek committed May 20, 2022
1 parent aacd2c8 commit 6ff124a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Candid/Utilities/NumericUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static BinarySequence ToBits(this BigInteger value, bool unsignedBits = f
{
byte[] bytes = value.ToByteArray(); // BigInteger returns twos compliment (signed) bytes
BinarySequence bits = BinarySequence.FromBytes(bytes, isBigEndian: false);
if (unsignedBits)
if (unsignedBits && bits.MostSignificantBit)
{
bits = bits.ToReverseTwosCompliment();
}
Expand Down

0 comments on commit 6ff124a

Please sign in to comment.