mapleFU commented on code in PR #43886:
URL: https://github.com/apache/arrow/pull/43886#discussion_r1736818727


##########
cpp/src/arrow/memory_pool.cc:
##########
@@ -916,6 +916,13 @@ class PoolBuffer final : public ResizableBuffer {
   }
 
  private:
+  static Result<int64_t> RoundCapacity(int64_t capacity) {
+    if (capacity > std::numeric_limits<int64_t>::max() - 63) {

Review Comment:
   It's a bit late in my tz, so I maybe stupid. why not 
`std::numeric_limits<int64_t>::max() - 64`? Since
   
   ```
   // Returns 'value' rounded up to the nearest multiple of 'factor' when factor
   // is a power of two.
   // The result is undefined on overflow, i.e. if `value > 2**64 - factor`,
   // since we cannot return the correct result which would be 2**64.
   constexpr int64_t RoundUpToPowerOf2(int64_t value, int64_t factor) {
     // DCHECK(value >= 0);
     // DCHECK(IsPowerOf2(factor));
     return (value + (factor - 1)) & ~(factor - 1);
   }
   ```



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