theirix commented on code in PR #9453:
URL: https://github.com/apache/arrow-rs/pull/9453#discussion_r2930154287


##########
arrow-buffer/src/bigint/mod.rs:
##########
@@ -614,6 +615,62 @@ impl i256 {
         let n = (n.high >> 64) as i64; // throw away the lower 192 bits
         (n as f64) * f64::powi(2.0, 192 - (k as i32)) // convert to f64 and 
scale it, as we left-shift k bit previous, so we need to scale it by 2^(192-k)
     }
+
+    /// Computes the `base` logarithm of the number `self`
+    /// Returns `None` if `self` is less than or equal to zero, or if `base` 
is less than 2.
+    #[inline]
+    pub fn checked_ilog(self, base: i256) -> Option<u32> {
+        if self <= Self::ZERO || base < i256::from(2) {

Review Comment:
   The reason was to place checks closer to the caller. For procmacros of i256, 
it's less clear from the source code, but [the 
documentation](https://docs.rs/i256/0.2.3/i256/struct.I256.html#method.checked_ilog)
 explicitly lists the required checks, and we repeat them in a docstring. 
Removed extra 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