Skip to content

Commit

Permalink
fix whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
ofek committed May 9, 2017
1 parent d5f4ff0 commit 9426432
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bit/bytes_int_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,23 @@ def int_to_bytes_big_endian(num):
num >>= 8
return bytes(bytestr)


def int_to_bytes_little_endian(num):
bytestr = []
while num > 0:
bytestr.append(num & 0xff)
num >>= 8
return bytes(bytestr)


def bytes_big_endian_to_int(bytestr):
num = 0
for b in bytestr:
num <<= 8
num += b
return num


def bytes_little_endian_to_int(bytestr):
num = 0
e = 0
Expand Down

0 comments on commit 9426432

Please sign in to comment.