jhorstmann commented on code in PR #5856:
URL: https://github.com/apache/arrow-rs/pull/5856#discussion_r1632873259


##########
parquet/src/thrift.rs:
##########
@@ -60,21 +61,17 @@ impl<'a> TCompactSliceInputProtocol<'a> {
     }
 
     fn read_vlq(&mut self) -> thrift::Result<u64> {
-        let mut in_progress = 0;
-        let mut shift = 0;
-        loop {
-            let byte = self.read_byte()?;
-            in_progress |= ((byte & 0x7F) as u64) << shift;
-            shift += 7;
-            if byte & 0x80 == 0 {
-                return Ok(in_progress);
-            }
-        }
+        let (val, shift) = unsafe { 
varint_simd::decode_unsafe(self.buf.as_ptr()) };

Review Comment:
   Safety docs for this function say
   
   > There must be at least 16 bytes of allocated memory after the beginning of 
the pointer.
   
   I think we need to check the remaining len and use the scalar code as a 
fallback for smaller lengths. Or somehow guarantee that the slice is always 
padded with 16 additional bytes at the end.



-- 
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]

Reply via email to