@@ -1547,24 +1547,16 @@ macro_rules! nonzero_integer_signedness_dependent_methods {
1547
1547
pub const fn isqrt( self ) -> Self {
1548
1548
let result = self . get( ) . isqrt( ) ;
1549
1549
1550
- // SAFETY: Inform the optimizer what the range of outputs is.
1551
- // If testing `core` crashes with no panic message and a
1552
- // `num::int_sqrt::u*` test failed, it's because your edits
1553
- // caused these assertions or the assertions in `fn isqrt` of
1554
- // `uint_macros.rs` to become false.
1550
+ // Inform the optimizer what the range of outputs is. The upper
1551
+ // bound was already handled by the `$Uint::isqrt` call just above.
1555
1552
//
1556
- // Integer square root is a monotonically nondecreasing
1557
- // function, which means that increasing the input will never
1558
- // cause the output to decrease.
1559
- //
1560
- // The minimum input is 1. When n is 1, sqrt(n) is 1. If n
1561
- // increases above 1, sqrt(n) can't decrease below 1, so sqrt(n)
1562
- // can't decrease below 1 no matter what n is.
1563
- //
1564
- // The maximum possible output already has an assertion in
1565
- // `fn isqrt` of `uint_macros.rs`.
1553
+ // SAFETY: Integer square root is a monotonically nondecreasing
1554
+ // function, which means that increasing the input will never cause
1555
+ // the output to decrease. Thus, since the input for nonzero
1556
+ // unsigned integers has a lower bound of 1, the lower bound of the
1557
+ // result will be sqrt(1), which is 1.
1566
1558
unsafe {
1567
- hint:: assert_unchecked( result > 0 ) ;
1559
+ hint:: assert_unchecked( result >= 1 ) ;
1568
1560
}
1569
1561
1570
1562
// SAFETY: As explained above, the minimum integer square root is
0 commit comments