Skip to content
Merged
5 changes: 4 additions & 1 deletion mypyc/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
SIZEOF_SIZE_T: Final = (
int(SIZEOF_SIZE_T_SYSCONFIG)
if SIZEOF_SIZE_T_SYSCONFIG is not None
else (math.log2(sys.maxsize) + 1) // 8
else round((math.log2(sys.maxsize + 1)) / 8)
Comment thread
emmatyping marked this conversation as resolved.
Outdated
)

IS_32_BIT_PLATFORM: Final = int(SIZEOF_SIZE_T) == 4
Expand All @@ -55,6 +55,9 @@
# Maximum value for a short tagged integer.
MAX_SHORT_INT: Final = 2 ** (8 * int(SIZEOF_SIZE_T) - 2) - 1

# Minimum value for a short tagged integer.
MIN_SHORT_INT: Final = -(MAX_SHORT_INT) - 1

# Maximum value for a short tagged integer represented as a C integer literal.
#
# Note: Assume that the compiled code uses the same bit width as mypyc, except for
Expand Down