From e81526f4fbcbec6c425956908edb2fc95e19f65c Mon Sep 17 00:00:00 2001 From: greateggsgreg <36009512+greateggsgreg@users.noreply.github.com> Date: Sun, 10 Aug 2025 12:50:35 -0400 Subject: [PATCH 1/2] Added _TAG_INTEGER_8 for Int64 integers --- src/typedstream/stream.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/typedstream/stream.py b/src/typedstream/stream.py index 2444db5..b6bdefa 100644 --- a/src/typedstream/stream.py +++ b/src/typedstream/stream.py @@ -122,6 +122,8 @@ _TAG_INTEGER_2 = -127 # Indicates an integer value, stored in 4 bytes. _TAG_INTEGER_4 = -126 +# Indicates an integer value, stored in 8 bytes. +_TAG_INTEGER_8 = -121 # Indicates a floating-point value, stored in 4 or 8 bytes (depending on whether it is a float or a double). _TAG_FLOATING_POINT = -125 # Indicates the start of a string value or an object that is stored literally and not as a backreference. From ede26089fb44a2fbaab0690b9674176344e4a279 Mon Sep 17 00:00:00 2001 From: greateggsgreg <36009512+greateggsgreg@users.noreply.github.com> Date: Sun, 10 Aug 2025 12:51:23 -0400 Subject: [PATCH 2/2] Added support for parsing Int64 integers --- src/typedstream/stream.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/typedstream/stream.py b/src/typedstream/stream.py index b6bdefa..295ccfb 100644 --- a/src/typedstream/stream.py +++ b/src/typedstream/stream.py @@ -679,6 +679,8 @@ def _read_integer(self, head: typing.Optional[int] = None, *, signed: bool) -> i return int.from_bytes(self._read_exact(2), self.byte_order, signed=signed) elif head == _TAG_INTEGER_4: return int.from_bytes(self._read_exact(4), self.byte_order, signed=signed) + elif head == _TAG_INTEGER_8: + return int.from_bytes(self._read_exact(8), self.byte_order, signed=signed) else: raise InvalidTypedStreamError(f"Invalid head tag in this context: {head} ({head & 0xff:#x})")