Copilot commented on code in PR #3745:
URL: https://github.com/apache/thrift/pull/3745#discussion_r3840243920
##########
lib/rb/lib/thrift/protocol/compact_protocol.rb:
##########
@@ -397,15 +397,16 @@ def read_byte
end
def read_i16
- zig_zag_to_int(read_varint32)
+ value = zig_zag_to_int(read_varint32) & 0xffff
+ value > I16_MAX ? value - (2**16) : value
Review Comment:
`read_i16` now computes `(2**16)` on every call. This is on a hot decode
path (and the PR already measured a small regression), so using a literal/shift
avoids the runtime exponentiation call while keeping behavior identical.
--
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]