We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bab64fd commit fbf52d3Copy full SHA for fbf52d3
lib/g3-types/src/codec/thrift/var_int.rs
@@ -20,7 +20,7 @@ impl ThriftVarInt32 {
20
// Get the varint value used directly in thrift protocol,
21
// which is always positive and not zigzag encoded
22
pub fn positive_value(&self) -> i32 {
23
- self.leb128.value() as i32
+ u32::cast_signed(self.leb128.value())
24
}
25
26
// Get the thrift integer value, which is zigzag encoded
@@ -48,6 +48,6 @@ impl ThriftVarIntEncoder {
48
49
// Encode the positive varint used directly in thrift protocol, which will not be zigzag encoded
50
pub fn encode_positive_i32(&mut self, v: i32) -> &[u8] {
51
- self.leb128.encode_u32(v as u32)
+ self.leb128.encode_u32(i32::cast_unsigned(v))
52
53
0 commit comments