Skip to main content

ConstIsqrt

Trait ConstIsqrt 

Source
pub trait ConstIsqrt: Sized + ConstZero {
    // Required methods
    fn isqrt(self) -> Self;
    fn checked_isqrt(self) -> Option<Self>;
}
Expand description

Const-compatible integer square root for unsigned integers.

Returns the largest integer r such that r * r <= self.

Required Methods§

Source

fn isqrt(self) -> Self

Returns the integer square root of self.

Source

fn checked_isqrt(self) -> Option<Self>

Returns the integer square root of self.

For unsigned types, this always returns Some. The checked variant exists for API consistency with signed types where negative values would return None.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T: ConstMachineWord + MachineWord, const N: usize> ConstIsqrt for FixedUInt<T, N>