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



##########
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);

Review comment:
       Actually, I'm not particularly clear about the difference between 
::arrow::util::SafeCopy<uint32_t> and static_cast<uint32_t>. Could you please 
tell me when should we use SafeCopy rather than static_cast?




-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to