chia-blockchain/chia/util/ints.py
Kyle Altendorf bbd032e1c9
embrace click 8 (#13559)
* click==8.1.3, black==22.8.0

* black

* click option creator hinting

* ignores for to-be-resolved issue

* remove unused import
2022-09-29 11:24:36 -05:00

64 lines
1.0 KiB
Python

from __future__ import annotations
from chia.util.struct_stream import StructStream, parse_metadata_from_name
@parse_metadata_from_name
class int8(StructStream):
pass
@parse_metadata_from_name
class uint8(StructStream):
pass
@parse_metadata_from_name
class int16(StructStream):
pass
@parse_metadata_from_name
class uint16(StructStream):
pass
@parse_metadata_from_name
class int32(StructStream):
pass
@parse_metadata_from_name
class uint32(StructStream):
pass
@parse_metadata_from_name
class int64(StructStream):
pass
@parse_metadata_from_name
class uint64(StructStream):
pass
@parse_metadata_from_name
class uint128(StructStream):
pass
class int512(StructStream):
PACK = None
# Uses 65 bytes to fit in the sign bit
SIZE = 65
BITS = 512
SIGNED = True
# note that the boundaries for int512 is not what you might expect. We
# encode these with one extra byte, but only allow a range of
# [-INT512_MAX, INT512_MAX]
MAXIMUM_EXCLUSIVE = 2**BITS
MINIMUM = -(2**BITS) + 1