ArjunPakhan opened a new pull request, #3548: URL: https://github.com/apache/iceberg-python/pull/3548
### Description Fixes an issue in `bytes_required` where negative numbers that are exact powers of two (e.g., `-128`, `-32768`) were over-allocated an extra byte of space. ### Context & Root Cause In two's complement representation, exact negative powers of two are clean boundaries where the Most Significant Bit (MSB) naturally represents the sign without requiring an extra padding bit. For example, `-128` fits perfectly within a single signed byte (`0x80`). The previous implementation calculated the byte length using Python's native `.bit_length()` directly on the integer magnitude: ```python return (value.bit_length() + 8) // 8 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
