initial commit
This commit is contained in:
commit
d421c1321b
580 files changed
+115527
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import struct
|
||||
|
||||
def byte2int(b):
|
||||
if isinstance(b, int):
|
||||
return b
|
||||
else:
|
||||
return struct.unpack("!B", b)[0]
|
||||
|
||||
def int2byte(i):
|
||||
return struct.pack("!B", i)
|
||||
|
||||
def join_bytes(bs):
|
||||
if len(bs) == 0:
|
||||
return ""
|
||||
else:
|
||||
rv = bs[0]
|
||||
for b in bs[1:]:
|
||||
rv += b
|
||||
return rv
|
||||
|
||||
Reference in new issue
Block a user