Kriskras99 commented on code in PR #336:
URL: https://github.com/apache/avro-rs/pull/336#discussion_r2522012479
##########
avro/src/util.rs:
##########
@@ -100,7 +100,8 @@ pub(crate) fn zag_i64<R: Read>(reader: &mut R) ->
AvroResult<i64> {
})
}
-fn encode_variable<W: Write>(mut z: u64, mut writer: W) -> AvroResult<usize> {
+fn encode_variable<W: Write>(n: i64, mut writer: W) -> AvroResult<usize> {
+ let mut z = (((n << 1) ^ (n >> 63)) as u64).to_le();
Review Comment:
No, `encode_variable` is purely used for zigzag encoding `int` and `long`
types.
The bit twiddling is to do the zigzag, while the remainder of the function
is for doing the varint encoding.
I've moved the bit twiddling back to `zig_i64`, and documented why they are
two different functions
--
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]