Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,8 @@ internal static ParsingStatus TryParseBigIntegerHexOrBinaryNumberStyle<TParser,
// Require to store in _bits.

// Positive: sign=1, bits=[leading]
// Negative: sign=-1, bits=[leading ^ -1 + 1]=[-leading]
result = new BigInteger((int)signBits | 1, [leading ^ signBits - signBits]);
// Negative: sign=-1, bits=[(leading ^ -1) + 1]=[-leading]
result = new BigInteger((int)signBits | 1, [(leading ^ signBits) - signBits]);
return ParsingStatus.OK;
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ public void Parse_Hex32Bits()
[InlineData("10000000000000000000000000000000", (long)int.MinValue)]
[InlineData("010000000000000000000000000000001", 0x080000001L)]
[InlineData("111111111111111111111111111111110", -2L)]
[InlineData("100000000000000000000000000000001", -0xFFFFFFFFL)]
[InlineData("0111111111111111111111111111111111", 0x1FFFFFFFFL)]
public void Parse_BinSpecialCases(string input, long expectedValue)
{
Expand Down