emkornfield commented on a change in pull request #10627:
URL: https://github.com/apache/arrow/pull/10627#discussion_r664746283



##########
File path: cpp/src/arrow/util/bit_stream_utils.h
##########
@@ -418,14 +450,65 @@ inline bool BitReader::GetVlqInt(uint32_t* v) {
 }
 
 inline bool BitWriter::PutZigZagVlqInt(int32_t v) {
-  auto u_v = ::arrow::util::SafeCopy<uint32_t>(v);
-  return PutVlqInt((u_v << 1) ^ (u_v >> 31));
+  uint32_t u_v = ::arrow::util::SafeCopy<uint32_t>(v);
+  v = (u_v << 1) ^ (v >> 31);
+  u_v = ::arrow::util::SafeCopy<uint32_t>(v);
+  return PutVlqInt(u_v);
 }
 
 inline bool BitReader::GetZigZagVlqInt(int32_t* v) {
   uint32_t u;
   if (!GetVlqInt(&u)) return false;
-  *v = ::arrow::util::SafeCopy<int32_t>((u >> 1) ^ (u << 31));
+  *v = ::arrow::util::SafeCopy<int32_t>(u);

Review comment:
       
https://github.com/protocolbuffers/protobuf/blob/0b05994474f3f53bbda8fef1c24acb06f778a3bf/src/google/protobuf/wire_format_lite.h#L867
 seems to be more concise and has a comptable license, could we use that and 
update license.txt to note the use of the code.




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