sim: fix zero encoding
This commit is contained in:
parent
decbd069fa
commit
678a89d572
|
@ -51,11 +51,14 @@ message_classes = [MessageTick, MessageGo, MessageWrite, MessageRead, MessageRea
|
||||||
#
|
#
|
||||||
|
|
||||||
def _pack_int(v):
|
def _pack_int(v):
|
||||||
p = []
|
if v == 0:
|
||||||
while v != 0:
|
p = [1, 0]
|
||||||
p.append(v & 0xff)
|
else:
|
||||||
v >>= 8
|
p = []
|
||||||
p.insert(0, len(p))
|
while v != 0:
|
||||||
|
p.append(v & 0xff)
|
||||||
|
v >>= 8
|
||||||
|
p.insert(0, len(p))
|
||||||
return p
|
return p
|
||||||
|
|
||||||
def _pack_str(v):
|
def _pack_str(v):
|
||||||
|
|
Loading…
Reference in New Issue