malachite_base/num/logic/
not.rs

1// Copyright © 2025 Mikhail Hogrefe
2//
3// This file is part of Malachite.
4//
5// Malachite is free software: you can redistribute it and/or modify it under the terms of the GNU
6// Lesser General Public License (LGPL) as published by the Free Software Foundation; either version
7// 3 of the License, or (at your option) any later version. See <https://www.gnu.org/licenses/>.
8
9use crate::num::logic::traits::NotAssign;
10
11macro_rules! impl_not {
12    ($t:ident) => {
13        impl NotAssign for $t {
14            /// Replaces a number with its bitwise negation.
15            ///
16            /// # Worst-case complexity
17            /// Constant time and additional memory.
18            ///
19            /// # Examples
20            /// See [here](super::not#not_assign).
21            #[inline]
22            fn not_assign(&mut self) {
23                *self = !*self;
24            }
25        }
26    };
27}
28apply_to_primitive_ints!(impl_not);