crypto-bigint 0.7.3

Pure Rust implementation of a big integer library which has been designed from the ground-up for use in cryptographic applications. Provides constant-time, no_std-friendly implementations of modern formulas using const generics.
Documentation
//! [`Int`] bitwise NOT operations.

use core::ops::Not;

use crate::Uint;

use super::Int;

impl<const LIMBS: usize> Int<LIMBS> {
    /// Computes bitwise `!a`.
    #[inline(always)]
    #[must_use]
    pub const fn not(&self) -> Self {
        Self(Uint::not(&self.0))
    }
}

impl<const LIMBS: usize> Not for Int<LIMBS> {
    type Output = Self;

    fn not(self) -> Self {
        Self::not(&self)
    }
}

#[cfg(test)]
mod tests {
    use crate::I128;

    #[test]
    fn bitnot_ok() {
        assert_eq!(I128::ZERO.not(), I128::MINUS_ONE);
        assert_eq!(I128::MAX.not(), I128::MIN);
    }
}