mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 15:38:11 +00:00
tools: update protobuf (sync with python-trezor)
This commit is contained in:
parent
5f9c079f5c
commit
b79ea10434
@ -53,6 +53,14 @@ class UVarintType:
|
||||
WIRE_TYPE = 0
|
||||
|
||||
|
||||
class Sint32Type:
|
||||
WIRE_TYPE = 0
|
||||
|
||||
|
||||
class Sint64Type:
|
||||
WIRE_TYPE = 0
|
||||
|
||||
|
||||
class BoolType:
|
||||
WIRE_TYPE = 0
|
||||
|
||||
@ -143,6 +151,10 @@ async def load_message(reader, msg_type):
|
||||
|
||||
if ftype is UVarintType:
|
||||
fvalue = ivalue
|
||||
elif ftype is Sint32Type:
|
||||
fvalue = (ivalue >> 1) ^ ((ivalue << 31) & 0xffffffff)
|
||||
elif ftype is Sint64Type:
|
||||
fvalue = (ivalue >> 1) ^ ((ivalue << 63) & 0xffffffffffffffff)
|
||||
elif ftype is BoolType:
|
||||
fvalue = bool(ivalue)
|
||||
elif ftype is BytesType:
|
||||
@ -199,6 +211,12 @@ async def dump_message(writer, msg):
|
||||
if ftype is UVarintType:
|
||||
await dump_uvarint(writer, svalue)
|
||||
|
||||
elif ftype is Sint32Type:
|
||||
await dump_uvarint(writer, ((svalue << 1) & 0xffffffff) ^ (svalue >> 31))
|
||||
|
||||
elif ftype is Sint64Type:
|
||||
await dump_uvarint(writer, ((svalue << 1) & 0xffffffffffffffff) ^ (svalue >> 63))
|
||||
|
||||
elif ftype is BoolType:
|
||||
await dump_uvarint(writer, int(svalue))
|
||||
|
||||
|
@ -39,6 +39,10 @@ def process_type(t, cls, msg_id, indexfile, is_upy):
|
||||
# TYPE_SINT32 = 17
|
||||
type = 'p.Sint32Type'
|
||||
|
||||
elif v.type in (18,):
|
||||
# TYPE_SINT64 = 18
|
||||
type = 'p.Sint64Type'
|
||||
|
||||
elif v.type == 9:
|
||||
# TYPE_STRING = 9
|
||||
type = 'p.UnicodeType'
|
||||
|
Loading…
Reference in New Issue
Block a user