Skip to content
This repository has been archived by the owner on Sep 10, 2019. It is now read-only.

Commit

Permalink
according to C#, BigInteger(0) is b'\x00'
Browse files Browse the repository at this point in the history
  • Loading branch information
igormcoelho committed May 29, 2018
1 parent 8d6ed7e commit 60e434d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions neocore/BigInteger.py
Expand Up @@ -15,6 +15,9 @@ def Equals(self, other):
return super(BigInteger, self).__eq__(other)

def ToByteArray(self, signed=True):
if self == 0:
return b'\x00'

if self < 0:
return self.to_bytes(1 + ((self.bit_length() + 7) // 8), byteorder='little', signed=True)

Expand Down

0 comments on commit 60e434d

Please sign in to comment.