pitrou commented on code in PR #14191:
URL: https://github.com/apache/arrow/pull/14191#discussion_r1030575454


##########
cpp/src/arrow/util/bit_stream_utils.h:
##########
@@ -204,8 +204,8 @@ class BitReader {
 
 inline bool BitWriter::PutValue(uint64_t v, int num_bits) {
   // TODO: revisit this limit if necessary (can be raised to 64 by fixing some 
edge cases)
-  DCHECK_LE(num_bits, 32);
-  DCHECK_EQ(v >> num_bits, 0) << "v = " << v << ", num_bits = " << num_bits;
+  DCHECK_LE(num_bits, 64);
+  //  DCHECK_EQ(v >> num_bits, 0) << "v = " << v << ", num_bits = " << 
num_bits;

Review Comment:
   However, the `v >> (num_bits - bit_offset_)` operation below might be 
undefined if `num_bits - bit_offset_` is 64.
   So I would change:
   ```c++
       buffered_values_ = v >> (num_bits - bit_offset_);
   ```
   into:
   ```c++
       buffered_values_ = (num_bits - bit_offset_ == 64) ? 0 : (v >> (num_bits 
- bit_offset_));
   ```
   



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