From 7f669aff6fb0f4c644880b739308889aaf279878 Mon Sep 17 00:00:00 2001 From: STerliakov Date: Thu, 17 Jul 2025 03:26:22 +0200 Subject: [PATCH] Remove int-float-int roundtrip --- scalecodec/types.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scalecodec/types.py b/scalecodec/types.py index 368286b..2d2b20c 100644 --- a/scalecodec/types.py +++ b/scalecodec/types.py @@ -52,7 +52,7 @@ def process_compact_bytes(self): elif byte_mod == 2: self.compact_length = 4 else: - self.compact_length = int(5 + (compact_byte[0] - 3) / 4) + self.compact_length = 5 + (compact_byte[0] - 3) // 4 if self.compact_length == 1: self.compact_bytes = compact_byte @@ -67,7 +67,7 @@ def process(self): self.process_compact_bytes() if self.compact_length <= 4: - return int(int.from_bytes(self.compact_bytes, byteorder='little') / 4) + return int.from_bytes(self.compact_bytes, byteorder='little') // 4 else: return int.from_bytes(self.compact_bytes, byteorder='little') @@ -114,7 +114,7 @@ def process(self): self.process_compact_bytes() if self.compact_length <= 4: - return int(int.from_bytes(self.compact_bytes, byteorder='little') / 4) + return int.from_bytes(self.compact_bytes, byteorder='little') // 4 else: return int.from_bytes(self.compact_bytes, byteorder='little')