We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d5f4ff0 commit 9426432Copy full SHA for 9426432
1 file changed
bit/bytes_int_conversion.py
@@ -9,20 +9,23 @@ def int_to_bytes_big_endian(num):
9
num >>= 8
10
return bytes(bytestr)
11
12
+
13
def int_to_bytes_little_endian(num):
14
bytestr = []
15
while num > 0:
16
bytestr.append(num & 0xff)
17
18
19
20
21
def bytes_big_endian_to_int(bytestr):
22
num = 0
23
for b in bytestr:
24
num <<= 8
25
num += b
26
return num
27
28
29
def bytes_little_endian_to_int(bytestr):
30
31
e = 0
0 commit comments