]>
git.proxmox.com Git - rustc.git/blob - vendor/crypto-bigint/src/uint/bit_not.rs
1 //! [`UInt`] bitwise not operations.
4 use crate::{Limb, Wrapping}
;
7 impl<const LIMBS
: usize> UInt
<LIMBS
> {
8 /// Computes bitwise `!a`.
10 pub const fn not(&self) -> Self {
11 let mut limbs
= [Limb
::ZERO
; LIMBS
];
15 limbs
[i
] = self.limbs
[i
].not();
23 impl<const LIMBS
: usize> Not
for UInt
<LIMBS
> {
26 fn not(self) -> <Self as Not
>::Output
{
31 impl<const LIMBS
: usize> Not
for Wrapping
<UInt
<LIMBS
>> {
34 fn not(self) -> <Self as Not
>::Output
{
35 Wrapping(self.0.not())
45 assert_eq
!(U128
::ZERO
.not(), U128
::MAX
);
46 assert_eq
!(U128
::MAX
.not(), U128
::ZERO
);