MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / decode_long

Function decode_long

tools/python-3.11.9-amd64/Lib/pickle.py:384–402  ·  view source on GitHub ↗

r"""Decode a long from a two's complement little-endian binary string. >>> decode_long(b'') 0 >>> decode_long(b"\xff\x00") 255 >>> decode_long(b"\xff\x7f") 32767 >>> decode_long(b"\x00\xff") -256 >>> decode_long(b"\x00\x80") -32768 >>> decode_

(data)

Source from the content-addressed store, hash-verified

382 return result
383
384def decode_long(data):
385 r"""Decode a long from a two's complement little-endian binary string.
386
387 >>> decode_long(b'')
388 0
389 >>> decode_long(b"\xff\x00")
390 255
391 >>> decode_long(b"\xff\x7f")
392 32767
393 >>> decode_long(b"\x00\xff")
394 -256
395 >>> decode_long(b"\x00\x80")
396 -32768
397 >>> decode_long(b"\x80")
398 -128
399 >>> decode_long(b"\x7f")
400 127
401 """
402 return int.from_bytes(data, byteorder='little', signed=True)
403
404
405# Pickling machinery

Callers 4

read_long1Function · 0.90
read_long4Function · 0.90
load_long1Method · 0.85
load_long4Method · 0.85

Calls 1

from_bytesMethod · 0.80

Tested by

no test coverage detected