summaryrefslogtreecommitdiffstats
path: root/vendor/crypto-bigint/src/limb/neg.rs
blob: b658bb9cd3a5485818c4f6c41dde60ae86b73237 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//! Limb negation

use crate::{Limb, Wrapping};
use core::ops::Neg;

impl Neg for Wrapping<Limb> {
    type Output = Self;

    fn neg(self) -> Self::Output {
        Self(self.0.wrapping_neg())
    }
}

impl Limb {
    /// Perform wrapping negation.
    #[inline(always)]
    pub const fn wrapping_neg(self) -> Self {
        Limb(self.0.wrapping_neg())
    }
}