Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix usage of BigInteger in DiscordBitSet.value
DiscordBitSet can only represent positive numbers, so the BigInteger used for getting a decimal representation can be constructed using the sign-magnitude representation instead of the two's-complement binary representation. This fixes two bugs: * DiscordBitSets with an empty data array couldn't be converted to a BigInteger because the constructor taking the two's-complement binary representation throws a NumberFormatException if the given array is empty. This bug was reported by @Tmpod: https://discord.com/channels/556525343595298817/1147254164469063773 * DiscordBitSets with a negative Long at the last position in their data array would be misinterpreted as negative numbers in the conversion to BigIntegers because the two's-complement binary representation was used. Example where this bug could be observed: // printed -9223372036854775808, should be 9223372036854775808 println(DiscordBitSet(1L shl 63).value)
- Loading branch information