fix: below or equal in var_int encoding

This commit is contained in:
ThomasV 2012-10-26 22:51:33 +02:00
parent 4038c0273f
commit faa002f53c
1 changed files with 2 additions and 2 deletions

View File

@ -31,9 +31,9 @@ def int_to_hex(i, length=1):
def var_int(i):
if i<0xfd:
return int_to_hex(i)
elif i<0xffff:
elif i<=0xffff:
return "fd"+int_to_hex(i,2)
elif i<0xffffffff:
elif i<=0xffffffff:
return "fe"+int_to_hex(i,4)
else:
return "ff"+int_to_hex(i,8)