Skip to main content

core/num/
mod.rs

1//! Numeric traits and functions for the built-in numeric types.
2
3#![stable(feature = "rust1", since = "1.0.0")]
4
5use crate::panic::const_panic;
6use crate::str::FromStr;
7use crate::ub_checks::assert_unsafe_precondition;
8use crate::{ascii, intrinsics, mem};
9
10// FIXME(const-hack): Used because the `?` operator is not allowed in a const context.
11macro_rules! try_opt {
12    ($e:expr) => {
13        match $e {
14            Some(x) => x,
15            None => return None,
16        }
17    };
18}
19
20// Use this when the generated code should differ between signed and unsigned types.
21macro_rules! sign_dependent_expr {
22    (signed ? if signed { $signed_case:expr } if unsigned { $unsigned_case:expr } ) => {
23        $signed_case
24    };
25    (unsigned ? if signed { $signed_case:expr } if unsigned { $unsigned_case:expr } ) => {
26        $unsigned_case
27    };
28}
29
30// These modules are public only for testing.
31#[doc(hidden)]
32#[unstable(
33    feature = "num_internals",
34    reason = "internal routines only exposed for testing",
35    issue = "none"
36)]
37pub mod imp;
38
39#[macro_use]
40mod int_macros; // import int_impl!
41#[macro_use]
42mod uint_macros; // import uint_impl!
43
44mod error;
45#[cfg(not(no_fp_fmt_parse))]
46mod float_parse;
47mod nonzero;
48mod saturating;
49mod traits;
50mod wrapping;
51
52/// 100% perma-unstable
53#[doc(hidden)]
54pub mod niche_types;
55
56#[stable(feature = "int_error_matching", since = "1.55.0")]
57pub use error::IntErrorKind;
58#[stable(feature = "rust1", since = "1.0.0")]
59pub use error::ParseIntError;
60#[stable(feature = "try_from", since = "1.34.0")]
61pub use error::TryFromIntError;
62#[stable(feature = "rust1", since = "1.0.0")]
63#[cfg(not(no_fp_fmt_parse))]
64pub use float_parse::ParseFloatError;
65#[stable(feature = "generic_nonzero", since = "1.79.0")]
66pub use nonzero::NonZero;
67#[unstable(
68    feature = "nonzero_internals",
69    reason = "implementation detail which may disappear or be replaced at any time",
70    issue = "none"
71)]
72pub use nonzero::ZeroablePrimitive;
73#[stable(feature = "signed_nonzero", since = "1.34.0")]
74pub use nonzero::{NonZeroI8, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI128, NonZeroIsize};
75#[stable(feature = "nonzero", since = "1.28.0")]
76pub use nonzero::{NonZeroU8, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU128, NonZeroUsize};
77#[stable(feature = "saturating_int_impl", since = "1.74.0")]
78pub use saturating::Saturating;
79#[stable(feature = "rust1", since = "1.0.0")]
80pub use wrapping::Wrapping;
81
82macro_rules! u8_xe_bytes_doc {
83    () => {
84        "
85
86**Note**: This function is meaningless on `u8`. Byte order does not exist as a
87concept for byte-sized integers. This function is only provided in symmetry
88with larger integer types.
89
90"
91    };
92}
93
94macro_rules! i8_xe_bytes_doc {
95    () => {
96        "
97
98**Note**: This function is meaningless on `i8`. Byte order does not exist as a
99concept for byte-sized integers. This function is only provided in symmetry
100with larger integer types. You can cast from and to `u8` using
101[`cast_signed`](u8::cast_signed) and [`cast_unsigned`](Self::cast_unsigned).
102
103"
104    };
105}
106
107macro_rules! usize_isize_to_xe_bytes_doc {
108    () => {
109        "
110
111**Note**: This function returns an array of length 2, 4 or 8 bytes
112depending on the target pointer size.
113
114"
115    };
116}
117
118macro_rules! usize_isize_from_xe_bytes_doc {
119    () => {
120        "
121
122**Note**: This function takes an array of length 2, 4 or 8 bytes
123depending on the target pointer size.
124
125"
126    };
127}
128
129macro_rules! midpoint_impl {
130    ($SelfT:ty, unsigned) => {
131        /// Calculates the midpoint (average) between `self` and `rhs`.
132        ///
133        /// `midpoint(a, b)` is `(a + b) / 2` as if it were performed in a
134        /// sufficiently-large unsigned integral type. This implies that the result is
135        /// always rounded towards zero and that no overflow will ever occur.
136        ///
137        /// # Examples
138        ///
139        /// ```
140        #[doc = concat!("assert_eq!(0", stringify!($SelfT), ".midpoint(4), 2);")]
141        #[doc = concat!("assert_eq!(1", stringify!($SelfT), ".midpoint(4), 2);")]
142        /// ```
143        #[stable(feature = "num_midpoint", since = "1.85.0")]
144        #[rustc_const_stable(feature = "num_midpoint", since = "1.85.0")]
145        #[must_use = "this returns the result of the operation, \
146                      without modifying the original"]
147        #[doc(alias = "average_floor")]
148        #[doc(alias = "average")]
149        #[inline]
150        pub const fn midpoint(self, rhs: $SelfT) -> $SelfT {
151            // Use the well known branchless algorithm from Hacker's Delight to compute
152            // `(a + b) / 2` without overflowing: `((a ^ b) >> 1) + (a & b)`.
153            ((self ^ rhs) >> 1) + (self & rhs)
154        }
155    };
156    ($SelfT:ty, signed) => {
157        /// Calculates the midpoint (average) between `self` and `rhs`.
158        ///
159        /// `midpoint(a, b)` is `(a + b) / 2` as if it were performed in a
160        /// sufficiently-large signed integral type. This implies that the result is
161        /// always rounded towards zero and that no overflow will ever occur.
162        ///
163        /// # Examples
164        ///
165        /// ```
166        #[doc = concat!("assert_eq!(0", stringify!($SelfT), ".midpoint(4), 2);")]
167        #[doc = concat!("assert_eq!((-1", stringify!($SelfT), ").midpoint(2), 0);")]
168        #[doc = concat!("assert_eq!((-7", stringify!($SelfT), ").midpoint(0), -3);")]
169        #[doc = concat!("assert_eq!(0", stringify!($SelfT), ".midpoint(-7), -3);")]
170        #[doc = concat!("assert_eq!(0", stringify!($SelfT), ".midpoint(7), 3);")]
171        /// ```
172        #[stable(feature = "num_midpoint_signed", since = "1.87.0")]
173        #[rustc_const_stable(feature = "num_midpoint_signed", since = "1.87.0")]
174        #[must_use = "this returns the result of the operation, \
175                      without modifying the original"]
176        #[doc(alias = "average_floor")]
177        #[doc(alias = "average_ceil")]
178        #[doc(alias = "average")]
179        #[inline]
180        pub const fn midpoint(self, rhs: Self) -> Self {
181            // Use the well known branchless algorithm from Hacker's Delight to compute
182            // `(a + b) / 2` without overflowing: `((a ^ b) >> 1) + (a & b)`.
183            let t = ((self ^ rhs) >> 1) + (self & rhs);
184            // Except that it fails for integers whose sum is an odd negative number as
185            // their floor is one less than their average. So we adjust the result.
186            t + (if t < 0 { 1 } else { 0 } & (self ^ rhs))
187        }
188    };
189    ($SelfT:ty, $WideT:ty, unsigned) => {
190        /// Calculates the midpoint (average) between `self` and `rhs`.
191        ///
192        /// `midpoint(a, b)` is `(a + b) / 2` as if it were performed in a
193        /// sufficiently-large unsigned integral type. This implies that the result is
194        /// always rounded towards zero and that no overflow will ever occur.
195        ///
196        /// # Examples
197        ///
198        /// ```
199        #[doc = concat!("assert_eq!(0", stringify!($SelfT), ".midpoint(4), 2);")]
200        #[doc = concat!("assert_eq!(1", stringify!($SelfT), ".midpoint(4), 2);")]
201        /// ```
202        #[stable(feature = "num_midpoint", since = "1.85.0")]
203        #[rustc_const_stable(feature = "num_midpoint", since = "1.85.0")]
204        #[must_use = "this returns the result of the operation, \
205                      without modifying the original"]
206        #[doc(alias = "average_floor")]
207        #[doc(alias = "average")]
208        #[inline]
209        pub const fn midpoint(self, rhs: $SelfT) -> $SelfT {
210            ((self as $WideT + rhs as $WideT) / 2) as $SelfT
211        }
212    };
213    ($SelfT:ty, $WideT:ty, signed) => {
214        /// Calculates the midpoint (average) between `self` and `rhs`.
215        ///
216        /// `midpoint(a, b)` is `(a + b) / 2` as if it were performed in a
217        /// sufficiently-large signed integral type. This implies that the result is
218        /// always rounded towards zero and that no overflow will ever occur.
219        ///
220        /// # Examples
221        ///
222        /// ```
223        #[doc = concat!("assert_eq!(0", stringify!($SelfT), ".midpoint(4), 2);")]
224        #[doc = concat!("assert_eq!((-1", stringify!($SelfT), ").midpoint(2), 0);")]
225        #[doc = concat!("assert_eq!((-7", stringify!($SelfT), ").midpoint(0), -3);")]
226        #[doc = concat!("assert_eq!(0", stringify!($SelfT), ".midpoint(-7), -3);")]
227        #[doc = concat!("assert_eq!(0", stringify!($SelfT), ".midpoint(7), 3);")]
228        /// ```
229        #[stable(feature = "num_midpoint_signed", since = "1.87.0")]
230        #[rustc_const_stable(feature = "num_midpoint_signed", since = "1.87.0")]
231        #[must_use = "this returns the result of the operation, \
232                      without modifying the original"]
233        #[doc(alias = "average_floor")]
234        #[doc(alias = "average_ceil")]
235        #[doc(alias = "average")]
236        #[inline]
237        pub const fn midpoint(self, rhs: $SelfT) -> $SelfT {
238            ((self as $WideT + rhs as $WideT) / 2) as $SelfT
239        }
240    };
241}
242
243macro_rules! widening_carryless_mul_impl {
244    ($SelfT:ty, $WideT:ty) => {
245        /// Performs a widening carry-less multiplication.
246        ///
247        /// # Examples
248        ///
249        /// ```
250        /// #![feature(uint_carryless_mul)]
251        ///
252        #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.widening_carryless_mul(",
253                                stringify!($SelfT), "::MAX), ", stringify!($WideT), "::MAX / 3);")]
254        /// ```
255        #[rustc_const_unstable(feature = "uint_carryless_mul", issue = "152080")]
256        #[doc(alias = "clmul")]
257        #[unstable(feature = "uint_carryless_mul", issue = "152080")]
258        #[must_use = "this returns the result of the operation, \
259                      without modifying the original"]
260        #[inline]
261        pub const fn widening_carryless_mul(self, rhs: $SelfT) -> $WideT {
262            (self as $WideT).carryless_mul(rhs as $WideT)
263        }
264    }
265}
266
267macro_rules! carrying_carryless_mul_impl {
268    (u128, u256) => {
269        carrying_carryless_mul_impl! { @internal u128 =>
270            pub const fn carrying_carryless_mul(self, rhs: Self, carry: Self) -> (Self, Self) {
271                let x0 = self as u64;
272                let x1 = (self >> 64) as u64;
273                let y0 = rhs as u64;
274                let y1 = (rhs >> 64) as u64;
275
276                let z0 = u64::widening_carryless_mul(x0, y0);
277                let z2 = u64::widening_carryless_mul(x1, y1);
278
279                // The grade school algorithm would compute:
280                // z1 = x0y1 ^ x1y0
281
282                // Instead, Karatsuba first computes:
283                let z3 = u64::widening_carryless_mul(x0 ^ x1, y0 ^ y1);
284                // Since it distributes over XOR,
285                // z3 == x0y0 ^ x0y1 ^ x1y0 ^ x1y1
286                //       |--|   |---------|   |--|
287                //    ==  z0  ^     z1      ^  z2
288                // so we can compute z1 as
289                let z1 = z3 ^ z0 ^ z2;
290
291                let lo = z0 ^ (z1 << 64);
292                let hi = z2 ^ (z1 >> 64);
293
294                (lo ^ carry, hi)
295            }
296        }
297    };
298    ($SelfT:ty, $WideT:ty) => {
299        carrying_carryless_mul_impl! { @internal $SelfT =>
300            pub const fn carrying_carryless_mul(self, rhs: Self, carry: Self) -> (Self, Self) {
301                // Can't use widening_carryless_mul because it's not implemented for usize.
302                let p = (self as $WideT).carryless_mul(rhs as $WideT);
303
304                let lo = (p as $SelfT);
305                let hi = (p  >> Self::BITS) as $SelfT;
306
307                (lo ^ carry, hi)
308            }
309        }
310    };
311    (@internal $SelfT:ty => $($fn:tt)*) => {
312        /// Calculates the "full carryless multiplication" without the possibility to overflow.
313        ///
314        /// This returns the low-order (wrapping) bits and the high-order (overflow) bits
315        /// of the result as two separate values, in that order.
316        ///
317        /// # Examples
318        ///
319        /// Please note that this example is shared among integer types, which is why `u8` is used.
320        ///
321        /// ```
322        /// #![feature(uint_carryless_mul)]
323        ///
324        /// assert_eq!(0b1000_0000u8.carrying_carryless_mul(0b1000_0000, 0b0000), (0, 0b0100_0000));
325        /// assert_eq!(0b1000_0000u8.carrying_carryless_mul(0b1000_0000, 0b1111), (0b1111, 0b0100_0000));
326        #[doc = concat!("assert_eq!(",
327            stringify!($SelfT), "::MAX.carrying_carryless_mul(", stringify!($SelfT), "::MAX, ", stringify!($SelfT), "::MAX), ",
328            "(!(", stringify!($SelfT), "::MAX / 3), ", stringify!($SelfT), "::MAX / 3));"
329        )]
330        /// ```
331        #[rustc_const_unstable(feature = "uint_carryless_mul", issue = "152080")]
332        #[doc(alias = "clmul")]
333        #[unstable(feature = "uint_carryless_mul", issue = "152080")]
334        #[must_use = "this returns the result of the operation, \
335                      without modifying the original"]
336        #[inline]
337        $($fn)*
338    }
339}
340
341impl i8 {
342    int_impl! {
343        Self = i8,
344        ActualT = i8,
345        UnsignedT = u8,
346        BITS = 8,
347        BITS_MINUS_ONE = 7,
348        Min = -128,
349        Max = 127,
350        rot = 2,
351        rot_op = "-0x7e",
352        rot_result = "0xa",
353        swap_op = "0x12",
354        swapped = "0x12",
355        reversed = "0x48",
356        le_bytes = "[0x12]",
357        be_bytes = "[0x12]",
358        to_xe_bytes_doc = "

**Note**: This function is meaningless on `i8`. Byte order does not exist as a
concept for byte-sized integers. This function is only provided in symmetry
with larger integer types. You can cast from and to `u8` using
[`cast_signed`](u8::cast_signed) and [`cast_unsigned`](Self::cast_unsigned).

"
"let bytes = 0x12i8.to_ne_bytes();"
"        [0x12]"
"        [0x12]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
unsafe { mem::transmute(self) }
"let value = i8::from_be_bytes([0x12]);"
"assert_eq!(value, 0x12);"
"fn read_be_i8(input: &mut &[u8]) -> i8 {"
"    let (int_bytes, rest) = input.split_at(size_of::<i8>());"
"    i8::from_be_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
Self::from_be(Self::from_ne_bytes(bytes));
"let value = i8::from_le_bytes([0x12]);"
"assert_eq!(value, 0x12);"
"fn read_le_i8(input: &mut &[u8]) -> i8 {"
"    let (int_bytes, rest) = input.split_at(size_of::<i8>());"
"    i8::from_le_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
Self::from_le(Self::from_ne_bytes(bytes));
"let value = i8::from_ne_bytes(if cfg!(target_endian = \"big\") {"
"    [0x12]"
"    [0x12]"
"assert_eq!(value, 0x12);"
"fn read_ne_i8(input: &mut &[u8]) -> i8 {"
"    let (int_bytes, rest) = input.split_at(size_of::<i8>());"
"    i8::from_ne_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
unsafe { mem::transmute(bytes) }
"[`i8::MIN`] instead."
"i8_legacy_fn_min_value"
Self
Self::MIN;
"[`i8::MAX`] instead."
"i8_legacy_fn_max_value"
Self
Self::MAX;
"assert_eq!(120i8.clamp_magnitude(100), 100);"
"assert_eq!(-120i8.clamp_magnitude(100), -100);"
"assert_eq!(80i8.clamp_magnitude(100), 80);"
"assert_eq!(-80i8.clamp_magnitude(100), -80);"
"this returns the clamped value and does not modify the original"
Self
self
limit
Self
if let Ok(limit) = core::convert::TryInto::<i8>::try_into(limit) {
    self.clamp(-limit, limit)
} else { self }
"assert_eq!(120i8, 120i8.truncate());"
"assert_eq!(-120i8, (-120i8).truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Target
traits::TruncateTarget::internal_truncate(self);
"assert_eq!(120i8, 120i8.saturating_truncate());"
"assert_eq!(-120i8, (-120i8).saturating_truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Target
traits::TruncateTarget::internal_saturating_truncate(self);
"assert_eq!(Some(120i8), 120i8.checked_truncate());"
"assert_eq!(Some(-120i8), (-120i8).checked_truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Option<Target>
traits::TruncateTarget::internal_checked_truncate(self);
"assert_eq!(120i128, 120i8.extend());"
"assert_eq!(-120i128, (-120i8).extend());"
"this returns the extended value and does not modify the original"
Self
Target
Self
self
Target
traits::ExtendTarget::internal_extend(self);i8_xe_bytes_doc!(),
359        from_xe_bytes_doc = "

**Note**: This function is meaningless on `i8`. Byte order does not exist as a
concept for byte-sized integers. This function is only provided in symmetry
with larger integer types. You can cast from and to `u8` using
[`cast_signed`](u8::cast_signed) and [`cast_unsigned`](Self::cast_unsigned).

"i8_xe_bytes_doc!(),
360        bound_condition = "",
361    }
362    "assert_eq!(0i8.midpoint(4), 2);"
"assert_eq!((-1i8).midpoint(2), 0);"
"assert_eq!((-7i8).midpoint(0), -3);"
"assert_eq!(0i8.midpoint(-7), -3);"
"assert_eq!(0i8.midpoint(7), 3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
((self as i16 + rhs as i16) / 2) as i8;midpoint_impl! { i8, i16, signed }
363}
364
365impl i16 {
366    "(&minus;2<sup>15</sup>)."
"assert_eq!(i16::MIN, -32768);"
Self
!Self::MAX
"(2<sup>15</sup> &minus; 1)."
"assert_eq!(i16::MAX, 32767);"
Self
(<u16>::MAX >> 1) as Self
"assert_eq!(i16::BITS, 16);"
u32
<u16>::BITS
"let n = 0b100_0000i16;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(self as u16).count_ones();
"assert_eq!(i16::MAX.count_zeros(), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(!self).count_ones();
"let n = -1i16;"
"[`ilog2`]: i16::ilog2"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(self as u16).leading_zeros();
"let n = -4i16;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(self as u16).trailing_zeros();
"let n = -1i16;"
"assert_eq!(n.leading_ones(), 16);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(self as u16).leading_ones();
"let n = 3i16;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(self as u16).trailing_ones();
"let n: i16 = 0b_01100100;"
"assert_eq!(0_i16.isolate_highest_one(), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
self & (((1 as i16) << (<i16>::BITS - 1)).wrapping_shr(self.leading_zeros()));
"let n: i16 = 0b_01100100;"
"assert_eq!(0_i16.isolate_lowest_one(), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
self & self.wrapping_neg();
"assert_eq!(0b0_i16.highest_one(), None);"
"assert_eq!(0b1_i16.highest_one(), Some(0));"
"assert_eq!(0b1_0000_i16.highest_one(), Some(4));"
"assert_eq!(0b1_1111_i16.highest_one(), Some(4));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
(self as u16).highest_one();
"assert_eq!(0b0_i16.lowest_one(), None);"
"assert_eq!(0b1_i16.lowest_one(), Some(0));"
"assert_eq!(0b1_0000_i16.lowest_one(), Some(4));"
"assert_eq!(0b1_1111_i16.lowest_one(), Some(0));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
(self as u16).lowest_one();
"let n = -1i16;"
"assert_eq!(n.cast_unsigned(), u16::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
self as u16;
"let n = -0x5ffdi16;"
"let m = 0x3a;"
"assert_eq!(n.rotate_left(4), m);"
"assert_eq!(n.rotate_left(1024), n);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
n
Self
(self as u16).rotate_left(n) as Self;
"let n = 0x3ai16;"
"let m = -0x5ffd;"
"assert_eq!(n.rotate_right(4), m);"
"assert_eq!(n.rotate_right(1024), n);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
n
Self
(self as u16).rotate_right(n) as Self;
"let n = 0x1234i16;"
"assert_eq!(m, 0x3412);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
(self as u16).swap_bytes() as Self;
"let n = 0x1234i16;"
"assert_eq!(m, 0x2c48);"
"assert_eq!(0, 0i16.reverse_bits());"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
(self as u16).reverse_bits() as Self;
"let n = 0x1Ai16;"
"    assert_eq!(i16::from_be(n), n)"
"    assert_eq!(i16::from_be(n), n.swap_bytes())"
Self
x
Self
{ x.swap_bytes() }
"let n = 0x1Ai16;"
"    assert_eq!(i16::from_le(n), n)"
"    assert_eq!(i16::from_le(n), n.swap_bytes())"
Self
x
Self
{ x }
"`i16`."
"let n = 0x1Ai16;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
{ self.swap_bytes() }
"`i16`."
"let n = 0x1Ai16;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
{ self }
"assert_eq!((i16::MAX - 2).checked_add(1), Some(i16::MAX - 1));"
"assert_eq!((i16::MAX - 2).checked_add(3), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
let (a, b) = self.overflowing_add(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!((i16::MAX - 2).strict_add(1), i16::MAX - 1);"
"let _ = (i16::MAX - 2).strict_add(3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_add(rhs);
if b { imp::overflow_panic::add() } else { a }
"`self + rhs > i16::MAX` or `self + rhs < i16::MIN`,"
"[`checked_add`]: i16::checked_add"
"[`wrapping_add`]: i16::wrapping_add"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: i16, rhs: i16) {
        if !!lhs.overflowing_add(rhs).1 {
            let msg =
                "unsafe precondition(s) violated: i16::unchecked_add cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::unchecked_add(self, rhs) }
"assert_eq!(1i16.checked_add_unsigned(2), Some(3));"
"assert_eq!((i16::MAX - 2).checked_add_unsigned(3), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Option<Self>
let (a, b) = self.overflowing_add_unsigned(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!(1i16.strict_add_unsigned(2), 3);"
"let _ = (i16::MAX - 2).strict_add_unsigned(3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Self
let (a, b) = self.overflowing_add_unsigned(rhs);
if b { imp::overflow_panic::add() } else { a }
"assert_eq!((i16::MIN + 2).checked_sub(1), Some(i16::MIN + 1));"
"assert_eq!((i16::MIN + 2).checked_sub(3), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
let (a, b) = self.overflowing_sub(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!((i16::MIN + 2).strict_sub(1), i16::MIN + 1);"
"let _ = (i16::MIN + 2).strict_sub(3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_sub(rhs);
if b { imp::overflow_panic::sub() } else { a }
"`self - rhs > i16::MAX` or `self - rhs < i16::MIN`,"
"[`checked_sub`]: i16::checked_sub"
"[`wrapping_sub`]: i16::wrapping_sub"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: i16, rhs: i16) {
        if !!lhs.overflowing_sub(rhs).1 {
            let msg =
                "unsafe precondition(s) violated: i16::unchecked_sub cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::unchecked_sub(self, rhs) }
"assert_eq!(1i16.checked_sub_unsigned(2), Some(-1));"
"assert_eq!((i16::MIN + 2).checked_sub_unsigned(3), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Option<Self>
let (a, b) = self.overflowing_sub_unsigned(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!(1i16.strict_sub_unsigned(2), -1);"
"let _ = (i16::MIN + 2).strict_sub_unsigned(3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Self
let (a, b) = self.overflowing_sub_unsigned(rhs);
if b { imp::overflow_panic::sub() } else { a }
"assert_eq!(i16::MAX.checked_mul(1), Some(i16::MAX));"
"assert_eq!(i16::MAX.checked_mul(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
let (a, b) = self.overflowing_mul(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!(i16::MAX.strict_mul(1), i16::MAX);"
"let _ = i16::MAX.strict_mul(2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_mul(rhs);
if b { imp::overflow_panic::mul() } else { a }
"`self * rhs > i16::MAX` or `self * rhs < i16::MIN`,"
"[`checked_mul`]: i16::checked_mul"
"[`wrapping_mul`]: i16::wrapping_mul"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: i16, rhs: i16) {
        if !!lhs.overflowing_mul(rhs).1 {
            let msg =
                "unsafe precondition(s) violated: i16::unchecked_mul cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::unchecked_mul(self, rhs) }
"assert_eq!((i16::MIN + 1).checked_div(-1), Some(32767));"
"assert_eq!(i16::MIN.checked_div(-1), None);"
"assert_eq!((1i16).checked_div(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0 || ((self == Self::MIN) && (rhs == -1))) {
    None
} else { Some(unsafe { intrinsics::unchecked_div(self, rhs) }) }
"assert_eq!((i16::MIN + 1).strict_div(-1), 32767);"
"let _ = i16::MIN.strict_div(-1);"
"let _ = (1i16).strict_div(0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_div(rhs);
if b { imp::overflow_panic::div() } else { a }
"assert_eq!((i16::MIN + 1).checked_div_euclid(-1), Some(32767));"
"assert_eq!(i16::MIN.checked_div_euclid(-1), None);"
"assert_eq!((1i16).checked_div_euclid(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0 || ((self == Self::MIN) & (rhs == -1))) {
    None
} else { Some(self.div_euclid(rhs)) }
"assert_eq!((i16::MIN + 1).strict_div_euclid(-1), 32767);"
"let _ = i16::MIN.strict_div_euclid(-1);"
"let _ = (1i16).strict_div_euclid(0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_div_euclid(rhs);
if b { imp::overflow_panic::div() } else { a }
"assert_eq!((i16::MIN + 1).checked_div_exact(-1), Some(32767));"
"assert_eq!((-5i16).checked_div_exact(2), None);"
"assert_eq!(i16::MIN.checked_div_exact(-1), None);"
"assert_eq!((1i16).checked_div_exact(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0 || ((self == Self::MIN) && (rhs == -1))) {
    None
} else {
    unsafe {
        if intrinsics::unlikely(intrinsics::unchecked_rem(self, rhs) != 0) {
            None
        } else { Some(intrinsics::exact_div(self, rhs)) }
    }
}
"assert_eq!(64i16.div_exact(2), Some(32));"
"assert_eq!(64i16.div_exact(32), Some(2));"
"assert_eq!((i16::MIN + 1).div_exact(-1), Some(32767));"
"assert_eq!(65i16.div_exact(2), None);"
"let _ = 64i16.div_exact(0);"
"let _ = i16::MIN.div_exact(-1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if self % rhs != 0 { None } else { Some(self / rhs) }
"`self == i16::MIN && rhs == -1`,"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: i16, rhs: i16) {
        if !(rhs > 0 && lhs % rhs == 0 && (lhs != <i16>::MIN || rhs != -1)) {
            let msg =
                "unsafe precondition(s) violated: i16::unchecked_div_exact cannot overflow, divide by zero, or leave a remainder\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::exact_div(self, rhs) }
"assert_eq!(5i16.checked_rem(2), Some(1));"
"assert_eq!(5i16.checked_rem(0), None);"
"assert_eq!(i16::MIN.checked_rem(-1), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0 || ((self == Self::MIN) && (rhs == -1))) {
    None
} else { Some(unsafe { intrinsics::unchecked_rem(self, rhs) }) }
"assert_eq!(5i16.strict_rem(2), 1);"
"let _ = 5i16.strict_rem(0);"
"let _ = i16::MIN.strict_rem(-1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_rem(rhs);
if b { imp::overflow_panic::rem() } else { a }
"assert_eq!(5i16.checked_rem_euclid(2), Some(1));"
"assert_eq!(5i16.checked_rem_euclid(0), None);"
"assert_eq!(i16::MIN.checked_rem_euclid(-1), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0 || ((self == Self::MIN) & (rhs == -1))) {
    None
} else { Some(self.rem_euclid(rhs)) }
"assert_eq!(5i16.strict_rem_euclid(2), 1);"
"let _ = 5i16.strict_rem_euclid(0);"
"let _ = i16::MIN.strict_rem_euclid(-1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_rem_euclid(rhs);
if b { imp::overflow_panic::rem() } else { a }
"assert_eq!(5i16.checked_neg(), Some(-5));"
"assert_eq!(i16::MIN.checked_neg(), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<Self>
let (a, b) = self.overflowing_neg();
if intrinsics::unlikely(b) { None } else { Some(a) }
"`self == i16::MIN`,"
"[`checked_neg`]: i16::checked_neg"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: i16) {
        if !!lhs.overflowing_neg().1 {
            let msg =
                "unsafe precondition(s) violated: i16::unchecked_neg cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(self); }
};
unsafe { intrinsics::unchecked_sub(0, self) }
"assert_eq!(5i16.strict_neg(), -5);"
"let _ = i16::MIN.strict_neg();"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
let (a, b) = self.overflowing_neg();
if b { imp::overflow_panic::neg() } else { a }
"assert_eq!(0x1i16.checked_shl(4), Some(0x10));"
"assert_eq!(0x1i16.checked_shl(129), None);"
"assert_eq!(0x10i16.checked_shl(15), Some(0));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<Self>
if rhs < Self::BITS { Some(unsafe { self.unchecked_shl(rhs) }) } else { None }
"assert_eq!(0x1i16.strict_shl(4), 0x10);"
"let _ = 0x1i16.strict_shl(129);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
let (a, b) = self.overflowing_shl(rhs);
if b { imp::overflow_panic::shl() } else { a }
"[`checked_shl`]: i16::checked_shl"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(rhs: u32) {
        if !(rhs < <i16>::BITS) {
            let msg =
                "unsafe precondition(s) violated: i16::unchecked_shl cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(rhs); }
};
unsafe { intrinsics::unchecked_shl(self, rhs) }
"assert_eq!(0x1_i16.unbounded_shl(4), 0x10);"
"assert_eq!(0x1_i16.unbounded_shl(129), 0);"
"assert_eq!(0b101_i16.unbounded_shl(0), 0b101);"
"assert_eq!(0b101_i16.unbounded_shl(1), 0b1010);"
"assert_eq!(0b101_i16.unbounded_shl(2), 0b10100);"
"assert_eq!(42_i16.unbounded_shl(16), 0);"
"assert_eq!(42_i16.unbounded_shl(1).unbounded_shl(15), 0);"
"assert_eq!((-13_i16).unbounded_shl(16), 0);"
"assert_eq!((-13_i16).unbounded_shl(1).unbounded_shl(15), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
if rhs < Self::BITS { unsafe { self.unchecked_shl(rhs) } } else { 0 }
"`i16::BITS`."
"assert_eq!(0x1i16.shl_exact(4), Some(0x10));"
"assert_eq!(0x1i16.shl_exact(i16::BITS - 2), Some(1 << i16::BITS - 2));"
"assert_eq!(0x1i16.shl_exact(i16::BITS - 1), None);"
"assert_eq!((-0x2i16).shl_exact(i16::BITS - 2), Some(-0x2 << i16::BITS - 2));"
"assert_eq!((-0x2i16).shl_exact(i16::BITS - 1), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<i16>
if rhs < self.leading_zeros() || rhs < self.leading_ones() {
    Some(unsafe { self.unchecked_shl(rhs) })
} else { None }
"`i16::BITS`."
"[`i16::shl_exact`]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(zeros: u32, ones: u32, rhs: u32) {
        if !(rhs < zeros || rhs < ones) {
            let msg =
                "unsafe precondition(s) violated: i16::unchecked_shl_exact cannot shift out bits that would change the value of the first bit\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_library_ub() {
        precondition_check(self.leading_zeros(), self.leading_ones(), rhs);
    }
};
unsafe { self.unchecked_shl(rhs) }
"assert_eq!(0x10i16.checked_shr(4), Some(0x1));"
"assert_eq!(0x10i16.checked_shr(128), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<Self>
if rhs < Self::BITS { Some(unsafe { self.unchecked_shr(rhs) }) } else { None }
"assert_eq!(0x10i16.strict_shr(4), 0x1);"
"let _ = 0x10i16.strict_shr(128);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
let (a, b) = self.overflowing_shr(rhs);
if b { imp::overflow_panic::shr() } else { a }
"[`checked_shr`]: i16::checked_shr"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(rhs: u32) {
        if !(rhs < <i16>::BITS) {
            let msg =
                "unsafe precondition(s) violated: i16::unchecked_shr cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(rhs); }
};
unsafe { intrinsics::unchecked_shr(self, rhs) }
"assert_eq!(0x10_i16.unbounded_shr(4), 0x1);"
"assert_eq!(0x10_i16.unbounded_shr(129), 0);"
"assert_eq!(i16::MIN.unbounded_shr(129), -1);"
"assert_eq!(0b1010_i16.unbounded_shr(0), 0b1010);"
"assert_eq!(0b1010_i16.unbounded_shr(1), 0b101);"
"assert_eq!(0b1010_i16.unbounded_shr(2), 0b10);"
"assert_eq!(42_i16.unbounded_shr(16), 0);"
"assert_eq!(42_i16.unbounded_shr(1).unbounded_shr(15), 0);"
"assert_eq!((-13_i16).unbounded_shr(16), -1);"
"assert_eq!((-13_i16).unbounded_shr(1).unbounded_shr(15), -1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
if rhs < Self::BITS {
    unsafe { self.unchecked_shr(rhs) }
} else { unsafe { self.unchecked_shr(Self::BITS - 1) } }
"`i16::BITS`."
"assert_eq!(0x10i16.shr_exact(4), Some(0x1));"
"assert_eq!(0x10i16.shr_exact(5), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<i16>
if rhs <= self.trailing_zeros() && rhs < <i16>::BITS {
    Some(unsafe { self.unchecked_shr(rhs) })
} else { None }
"`i16::BITS`."
"i16::BITS`"
"[`i16::shr_exact`]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(zeros: u32, bits: u32, rhs: u32) {
        if !(rhs <= zeros && rhs < bits) {
            let msg =
                "unsafe precondition(s) violated: i16::unchecked_shr_exact cannot shift out non-zero bits\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_library_ub() {
        precondition_check(self.trailing_zeros(), <i16>::BITS, rhs);
    }
};
unsafe { self.unchecked_shr(rhs) }
"assert_eq!((-5i16).checked_abs(), Some(5));"
"assert_eq!(i16::MIN.checked_abs(), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<Self>
if self.is_negative() { self.checked_neg() } else { Some(self) }
"assert_eq!((-5i16).strict_abs(), 5);"
"let _ = i16::MIN.strict_abs();"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
if self.is_negative() { self.strict_neg() } else { self }
"assert_eq!(8i16.checked_pow(2), Some(64));"
"assert_eq!(0_i16.checked_pow(0), Some(1));"
"assert_eq!(i16::MAX.checked_pow(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Option<Self>
if exp == 0 { return Some(1); }
let mut base = self;
let mut acc: Self = 1;
loop {
    if (exp & 1) == 1 {
        acc =
            match acc.checked_mul(base) {
                Some(x) => x,
                None => return None,
            };
        if exp == 1 { return Some(acc); }
    }
    exp /= 2;
    base =
        match base.checked_mul(base) { Some(x) => x, None => return None, };
}
"assert_eq!(8i16.strict_pow(2), 64);"
"assert_eq!(0_i16.strict_pow(0), 1);"
"let _ = i16::MAX.strict_pow(2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Self
if exp == 0 { return 1; }
let mut base = self;
let mut acc: Self = 1;
loop {
    if (exp & 1) == 1 {
        acc = acc.strict_mul(base);
        if exp == 1 { return acc; }
    }
    exp /= 2;
    base = base.strict_mul(base);
}
"assert_eq!(10i16.checked_isqrt(), Some(3));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<Self>
if self < 0 {
    None
} else {
    let result = unsafe { imp::int_sqrt::i16(self as i16) as i16 };
    unsafe {
        const MAX_RESULT: i16 =
            unsafe { imp::int_sqrt::i16(<i16>::MAX) as i16 };
        crate::hint::assert_unchecked(result >= 0);
        crate::hint::assert_unchecked(result <= MAX_RESULT);
    }
    Some(result)
}
"assert_eq!(100i16.saturating_add(1), 101);"
"assert_eq!(i16::MAX.saturating_add(100), i16::MAX);"
"assert_eq!(i16::MIN.saturating_add(-1), i16::MIN);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::saturating_add(self, rhs);
"assert_eq!(1i16.saturating_add_unsigned(2), 3);"
"assert_eq!(i16::MAX.saturating_add_unsigned(100), i16::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Self
match self.checked_add_unsigned(rhs) { Some(x) => x, None => Self::MAX, }
"assert_eq!(100i16.saturating_sub(127), -27);"
"assert_eq!(i16::MIN.saturating_sub(100), i16::MIN);"
"assert_eq!(i16::MAX.saturating_sub(-1), i16::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::saturating_sub(self, rhs);
"assert_eq!(100i16.saturating_sub_unsigned(127), -27);"
"assert_eq!(i16::MIN.saturating_sub_unsigned(100), i16::MIN);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Self
match self.checked_sub_unsigned(rhs) { Some(x) => x, None => Self::MIN, }
"assert_eq!(100i16.saturating_neg(), -100);"
"assert_eq!((-100i16).saturating_neg(), 100);"
"assert_eq!(i16::MIN.saturating_neg(), i16::MAX);"
"assert_eq!(i16::MAX.saturating_neg(), i16::MIN + 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
intrinsics::saturating_sub(0, self);
"assert_eq!(100i16.saturating_abs(), 100);"
"assert_eq!((-100i16).saturating_abs(), 100);"
"assert_eq!(i16::MIN.saturating_abs(), i16::MAX);"
"assert_eq!((i16::MIN + 1).saturating_abs(), i16::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
if self.is_negative() { self.saturating_neg() } else { self }
"assert_eq!(10i16.saturating_mul(12), 120);"
"assert_eq!(i16::MAX.saturating_mul(10), i16::MAX);"
"assert_eq!(i16::MIN.saturating_mul(10), i16::MIN);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
match self.checked_mul(rhs) {
    Some(x) => x,
    None => if (self < 0) == (rhs < 0) { Self::MAX } else { Self::MIN },
}
"assert_eq!(5i16.saturating_div(2), 2);"
"assert_eq!(i16::MAX.saturating_div(-1), i16::MIN + 1);"
"assert_eq!(i16::MIN.saturating_div(-1), i16::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
match self.overflowing_div(rhs) {
    (result, false) => result,
    (_result, true) => Self::MAX,
}
"assert_eq!((-4i16).saturating_pow(3), -64);"
"assert_eq!(0_i16.saturating_pow(0), 1);"
"assert_eq!(i16::MIN.saturating_pow(2), i16::MAX);"
"assert_eq!(i16::MIN.saturating_pow(3), i16::MIN);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
exp
Self
match self.checked_pow(exp) {
    Some(x) => x,
    None if self < 0 && exp % 2 == 1 => Self::MIN,
    None => Self::MAX,
}
"assert_eq!(100i16.wrapping_add(27), 127);"
"assert_eq!(i16::MAX.wrapping_add(2), i16::MIN + 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::wrapping_add(self, rhs);
"assert_eq!(100i16.wrapping_add_unsigned(27), 127);"
"assert_eq!(i16::MAX.wrapping_add_unsigned(2), i16::MIN + 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Self
self.wrapping_add(rhs as Self);
"assert_eq!(0i16.wrapping_sub(127), -127);"
"assert_eq!((-2i16).wrapping_sub(i16::MAX), i16::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::wrapping_sub(self, rhs);
"assert_eq!(0i16.wrapping_sub_unsigned(127), -127);"
"assert_eq!((-2i16).wrapping_sub_unsigned(u16::MAX), -1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Self
self.wrapping_sub(rhs as Self);
"assert_eq!(10i16.wrapping_mul(12), 120);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::wrapping_mul(self, rhs);
"assert_eq!(100i16.wrapping_div(10), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self.overflowing_div(rhs).0;
"assert_eq!(100i16.wrapping_div_euclid(10), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self.overflowing_div_euclid(rhs).0;
"assert_eq!(100i16.wrapping_rem(10), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self.overflowing_rem(rhs).0;
"assert_eq!(100i16.wrapping_rem_euclid(10), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self.overflowing_rem_euclid(rhs).0;
"assert_eq!(100i16.wrapping_neg(), -100);"
"assert_eq!((-100i16).wrapping_neg(), 100);"
"assert_eq!(i16::MIN.wrapping_neg(), i16::MIN);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
(0 as i16).wrapping_sub(self);
"assert_eq!((-1_i16).wrapping_shl(7), -128);"
"assert_eq!(42_i16.wrapping_shl(16), 42);"
"assert_eq!(42_i16.wrapping_shl(1).wrapping_shl(15), 0);"
"assert_eq!((-1_i16).wrapping_shl(128), -1);"
"assert_eq!(5_i16.wrapping_shl(1025), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
unsafe { self.unchecked_shl(rhs & (Self::BITS - 1)) }
"assert_eq!((-128_i16).wrapping_shr(7), -1);"
"assert_eq!(42_i16.wrapping_shr(16), 42);"
"assert_eq!(42_i16.wrapping_shr(1).wrapping_shr(15), 0);"
"assert_eq!(10_i16.wrapping_shr(1025), 5);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
unsafe { self.unchecked_shr(rhs & (Self::BITS - 1)) }
"assert_eq!(100i16.wrapping_abs(), 100);"
"assert_eq!((-100i16).wrapping_abs(), 100);"
"assert_eq!(i16::MIN.wrapping_abs(), i16::MIN);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
if self.is_negative() { self.wrapping_neg() } else { self }
"assert_eq!(100i16.unsigned_abs(), 100u16);"
"assert_eq!((-100i16).unsigned_abs(), 100u16);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
self.wrapping_abs() as u16;
"assert_eq!(3i16.wrapping_pow(4), 81);"
"assert_eq!(0_i16.wrapping_pow(0), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Self
if exp == 0 { return 1; }
let mut base = self;
let mut acc: Self = 1;
if intrinsics::is_val_statically_known(exp) {
    while exp > 1 {
        if (exp & 1) == 1 { acc = acc.wrapping_mul(base); }
        exp /= 2;
        base = base.wrapping_mul(base);
    }
    acc.wrapping_mul(base)
} else {
    loop {
        if (exp & 1) == 1 {
            acc = acc.wrapping_mul(base);
            if exp == 1 { return acc; }
        }
        exp /= 2;
        base = base.wrapping_mul(base);
    }
}
"assert_eq!(5i16.overflowing_add(2), (7, false));"
"assert_eq!(i16::MAX.overflowing_add(1), (i16::MIN, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
let (a, b) = intrinsics::add_with_overflow(self as i16, rhs as i16);
(a as Self, b);
"[`u16::carrying_add`]"
"//   10  MAX    (a = 10 \u{d7} 2^16 + 2^16 - 1)"
"// + -5    9    (b = -5 \u{d7} 2^16 + 9)"
"//    6    8    (sum = 6 \u{d7} 2^16 + 8)"
"let (a1, a0): (i16, u16) = (10, u16::MAX);"
"let (b1, b0): (i16, u16) = (-5, 9);"
"// u16::carrying_add for the less significant words"
"// i16::carrying_add for the most significant word"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
bool
carry
(Self, bool)
let (a, b) = self.overflowing_add(rhs);
let (c, d) = a.overflowing_add(carry as i16);
(c, b != d);
"assert_eq!(1i16.overflowing_add_unsigned(2), (3, false));"
"assert_eq!((i16::MIN).overflowing_add_unsigned(u16::MAX), (i16::MAX, false));"
"assert_eq!((i16::MAX - 2).overflowing_add_unsigned(3), (i16::MIN, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
(Self, bool)
let rhs = rhs as Self;
let (res, overflowed) = self.overflowing_add(rhs);
(res, overflowed ^ (rhs < 0));
"assert_eq!(5i16.overflowing_sub(2), (3, false));"
"assert_eq!(i16::MIN.overflowing_sub(1), (i16::MAX, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
let (a, b) = intrinsics::sub_with_overflow(self as i16, rhs as i16);
(a as Self, b);
"[`u16::borrowing_sub`]"
"//    6    8    (a = 6 \u{d7} 2^16 + 8)"
"// - -5    9    (b = -5 \u{d7} 2^16 + 9)"
"//   10  MAX    (diff = 10 \u{d7} 2^16 + 2^16 - 1)"
"let (a1, a0): (i16, u16) = (6, 8);"
"let (b1, b0): (i16, u16) = (-5, 9);"
"// u16::borrowing_sub for the less significant words"
"// i16::borrowing_sub for the most significant word"
"assert_eq!((diff1, diff0), (10, u16::MAX));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
bool
borrow
(Self, bool)
let (a, b) = self.overflowing_sub(rhs);
let (c, d) = a.overflowing_sub(borrow as i16);
(c, b != d);
"assert_eq!(1i16.overflowing_sub_unsigned(2), (-1, false));"
"assert_eq!((i16::MAX).overflowing_sub_unsigned(u16::MAX), (i16::MIN, false));"
"assert_eq!((i16::MIN + 2).overflowing_sub_unsigned(3), (i16::MAX, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
(Self, bool)
let rhs = rhs as Self;
let (res, overflowed) = self.overflowing_sub(rhs);
(res, overflowed ^ (rhs < 0));
"assert_eq!(5i16.overflowing_mul(2), (10, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
let (a, b) = intrinsics::mul_with_overflow(self as i16, rhs as i16);
(a as Self, b);
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(u16, Self)
Self::carrying_mul_add(self, rhs, 0, 0);
"assert_eq!(i16::MAX.carrying_mul(i16::MAX, i16::MAX), (i16::MAX.unsigned_abs() + 1, i16::MAX / 2));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
carry
(u16, Self)
Self::carrying_mul_add(self, rhs, carry, 0);
"assert_eq!(i16::MAX.carrying_mul_add(i16::MAX, i16::MAX, i16::MAX), (u16::MAX, i16::MAX / 2));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
carry
Self
add
(u16, Self)
intrinsics::carrying_mul_add(self, rhs, carry, add);
"assert_eq!(5i16.overflowing_div(2), (2, false));"
"assert_eq!(i16::MIN.overflowing_div(-1), (i16::MIN, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
if intrinsics::unlikely((self == Self::MIN) & (rhs == -1)) {
    (self, true)
} else { (self / rhs, false) }
"assert_eq!(5i16.overflowing_div_euclid(2), (2, false));"
"assert_eq!(i16::MIN.overflowing_div_euclid(-1), (i16::MIN, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
if intrinsics::unlikely((self == Self::MIN) & (rhs == -1)) {
    (self, true)
} else { (self.div_euclid(rhs), false) }
"assert_eq!(5i16.overflowing_rem(2), (1, false));"
"assert_eq!(i16::MIN.overflowing_rem(-1), (0, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
if intrinsics::unlikely(rhs == -1) {
    (0, self == Self::MIN)
} else { (self % rhs, false) }
"assert_eq!(5i16.overflowing_rem_euclid(2), (1, false));"
"assert_eq!(i16::MIN.overflowing_rem_euclid(-1), (0, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
if intrinsics::unlikely(rhs == -1) {
    (0, self == Self::MIN)
} else { (self.rem_euclid(rhs), false) }
"assert_eq!(2i16.overflowing_neg(), (-2, false));"
"assert_eq!(i16::MIN.overflowing_neg(), (i16::MIN, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
(Self, bool)
if intrinsics::unlikely(self == Self::MIN) {
    (Self::MIN, true)
} else { (-self, false) }
"assert_eq!(0x1i16.overflowing_shl(4), (0x10, false));"
"assert_eq!(0x10i16.overflowing_shl(15), (0, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
(Self, bool)
(self.wrapping_shl(rhs), rhs >= Self::BITS);
"assert_eq!(0x10i16.overflowing_shr(4), (0x1, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
(Self, bool)
(self.wrapping_shr(rhs), rhs >= Self::BITS);
"(e.g., i16::MIN for values of type i16),"
"assert_eq!(10i16.overflowing_abs(), (10, false));"
"assert_eq!((-10i16).overflowing_abs(), (10, false));"
"assert_eq!((i16::MIN).overflowing_abs(), (i16::MIN, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
(Self, bool)
(self.wrapping_abs(), self == Self::MIN);
"assert_eq!(3i16.overflowing_pow(4), (81, false));"
"assert_eq!(0_i16.overflowing_pow(0), (1, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
(Self, bool)
if exp == 0 { return (1, false); }
let mut base = self;
let mut acc: Self = 1;
let mut overflown = false;
let mut r;
loop {
    if (exp & 1) == 1 {
        r = acc.overflowing_mul(base);
        if exp == 1 { r.1 |= overflown; return r; }
        acc = r.0;
        overflown |= r.1;
    }
    exp /= 2;
    r = base.overflowing_mul(base);
    base = r.0;
    overflown |= r.1;
}
"let x: i16 = 2; // or any other integer type"
"assert_eq!(0_i16.pow(0), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Self
if exp == 0 { return 1; }
let mut base = self;
let mut acc = 1;
if intrinsics::is_val_statically_known(exp) {
    while exp > 1 {
        if (exp & 1) == 1 { acc = acc * base; }
        exp /= 2;
        base = base * base;
    }
    acc * base
} else {
    loop {
        if (exp & 1) == 1 { acc = acc * base; if exp == 1 { return acc; } }
        exp /= 2;
        base = base * base;
    }
}
"assert_eq!(10i16.isqrt(), 3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
match self.checked_isqrt() {
    Some(sqrt) => sqrt,
    None => imp::int_sqrt::panic_for_negative_argument(),
}
"let a: i16 = 7; // or any other integer type"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let q = self / rhs;
if self % rhs < 0 { return if rhs > 0 { q - 1 } else { q + 1 } }
q;
"let a: i16 = 7; // or any other integer type"
"let _ = i16::MIN.rem_euclid(-1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let r = self % rhs;
if r < 0 { r.wrapping_add(rhs.wrapping_abs()) } else { r }
"let a: i16 = 8;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let d = self / rhs;
let r = self % rhs;
let correction = (self ^ rhs) >> (Self::BITS - 1);
if r != 0 { d + correction } else { d }
"let a: i16 = 8;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let d = self / rhs;
let r = self % rhs;
let correction = 1 + ((self ^ rhs) >> (Self::BITS - 1));
if r != 0 { d + correction } else { d }
"assert_eq!(16_i16.next_multiple_of(8), 16);"
"assert_eq!(23_i16.next_multiple_of(8), 24);"
"assert_eq!(16_i16.next_multiple_of(-8), 16);"
"assert_eq!(23_i16.next_multiple_of(-8), 16);"
"assert_eq!((-16_i16).next_multiple_of(8), -16);"
"assert_eq!((-23_i16).next_multiple_of(8), -16);"
"assert_eq!((-16_i16).next_multiple_of(-8), -16);"
"assert_eq!((-23_i16).next_multiple_of(-8), -24);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
if rhs == -1 { return self; }
let r = self % rhs;
let m = if (r > 0 && rhs < 0) || (r < 0 && rhs > 0) { r + rhs } else { r };
if m == 0 { self } else { self + (rhs - m) }
"assert_eq!(16_i16.checked_next_multiple_of(8), Some(16));"
"assert_eq!(23_i16.checked_next_multiple_of(8), Some(24));"
"assert_eq!(16_i16.checked_next_multiple_of(-8), Some(16));"
"assert_eq!(23_i16.checked_next_multiple_of(-8), Some(16));"
"assert_eq!((-16_i16).checked_next_multiple_of(8), Some(-16));"
"assert_eq!((-23_i16).checked_next_multiple_of(8), Some(-16));"
"assert_eq!((-16_i16).checked_next_multiple_of(-8), Some(-16));"
"assert_eq!((-23_i16).checked_next_multiple_of(-8), Some(-24));"
"assert_eq!(1_i16.checked_next_multiple_of(0), None);"
"assert_eq!(i16::MAX.checked_next_multiple_of(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if rhs == -1 { return Some(self); }
let r = match self.checked_rem(rhs) { Some(x) => x, None => return None, };
let m = if (r > 0 && rhs < 0) || (r < 0 && rhs > 0) { r + rhs } else { r };
if m == 0 { Some(self) } else { self.checked_add(rhs - m) }
"assert_eq!(5i16.ilog(5), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
base
u32
if !(base >= 2) {
    {
        crate::panicking::panic_fmt(format_args!("base of integer logarithm must be at least 2"));
    }
};
if let Some(log) = self.checked_ilog(base) {
    log
} else { imp::int_log10::panic_for_nonpositive_argument() }
"assert_eq!(2i16.ilog2(), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
if let Some(log) = self.checked_ilog2() {
    log
} else { imp::int_log10::panic_for_nonpositive_argument() }
"assert_eq!(10i16.ilog10(), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
if let Some(log) = self.checked_ilog10() {
    log
} else { imp::int_log10::panic_for_nonpositive_argument() }
"assert_eq!(5i16.checked_ilog(5), Some(1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
base
Option<u32>
if self <= 0 || base <= 1 {
    None
} else { (self as u16).checked_ilog(base as u16) }
"assert_eq!(2i16.checked_ilog2(), Some(1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
if self <= 0 {
    None
} else {
    let log =
        (Self::BITS - 1) - unsafe { intrinsics::ctlz_nonzero(self) as u32 };
    Some(log)
}
"assert_eq!(10i16.checked_ilog10(), Some(1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
imp::int_log10::i16(self as i16);
"`i16::MIN`"
"`i16`,"
"`i16::MIN`"
"assert_eq!(10i16.abs(), 10);"
"assert_eq!((-10i16).abs(), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
if self.is_negative() { -self } else { self }
"assert_eq!(100i16.abs_diff(80), 20u16);"
"assert_eq!(100i16.abs_diff(110), 10u16);"
"assert_eq!((-100i16).abs_diff(80), 180u16);"
"assert_eq!((-100i16).abs_diff(-120), 20u16);"
"assert_eq!(i16::MIN.abs_diff(i16::MAX), u16::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
other
if self < other {
    (other as u16).wrapping_sub(self as u16)
} else { (self as u16).wrapping_sub(other as u16) }
"assert_eq!(10i16.signum(), 1);"
"assert_eq!(0i16.signum(), 0);"
"assert_eq!((-10i16).signum(), -1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
crate::intrinsics::three_way_compare(self, 0) as Self;
"assert!(10i16.is_positive());"
"assert!(!(-10i16).is_positive());"
Self
self
bool
self > 0;
"assert!((-10i16).is_negative());"
"assert!(!10i16.is_negative());"
Self
self
bool
self < 0;
"let bytes = 0x1234i16.to_be_bytes();"
"assert_eq!(bytes, [0x12, 0x34]);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
self.to_be().to_ne_bytes();
"let bytes = 0x1234i16.to_le_bytes();"
"assert_eq!(bytes, [0x34, 0x12]);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
self.to_le().to_ne_bytes();
"let bytes = 0x1234i16.to_ne_bytes();"
"        [0x12, 0x34]"
"        [0x34, 0x12]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
unsafe { mem::transmute(self) }
"let value = i16::from_be_bytes([0x12, 0x34]);"
"assert_eq!(value, 0x1234);"
"fn read_be_i16(input: &mut &[u8]) -> i16 {"
"    let (int_bytes, rest) = input.split_at(size_of::<i16>());"
"    i16::from_be_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
Self::from_be(Self::from_ne_bytes(bytes));
"let value = i16::from_le_bytes([0x34, 0x12]);"
"assert_eq!(value, 0x1234);"
"fn read_le_i16(input: &mut &[u8]) -> i16 {"
"    let (int_bytes, rest) = input.split_at(size_of::<i16>());"
"    i16::from_le_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
Self::from_le(Self::from_ne_bytes(bytes));
"let value = i16::from_ne_bytes(if cfg!(target_endian = \"big\") {"
"    [0x12, 0x34]"
"    [0x34, 0x12]"
"assert_eq!(value, 0x1234);"
"fn read_ne_i16(input: &mut &[u8]) -> i16 {"
"    let (int_bytes, rest) = input.split_at(size_of::<i16>());"
"    i16::from_ne_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
unsafe { mem::transmute(bytes) }
"[`i16::MIN`] instead."
"i16_legacy_fn_min_value"
Self
Self::MIN;
"[`i16::MAX`] instead."
"i16_legacy_fn_max_value"
Self
Self::MAX;
"assert_eq!(120i16.clamp_magnitude(100), 100);"
"assert_eq!(-120i16.clamp_magnitude(100), -100);"
"assert_eq!(80i16.clamp_magnitude(100), 80);"
"assert_eq!(-80i16.clamp_magnitude(100), -80);"
"this returns the clamped value and does not modify the original"
Self
self
limit
Self
if let Ok(limit) = core::convert::TryInto::<i16>::try_into(limit) {
    self.clamp(-limit, limit)
} else { self }
"assert_eq!(120i8, 120i16.truncate());"
"assert_eq!(-120i8, (-120i16).truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Target
traits::TruncateTarget::internal_truncate(self);
"assert_eq!(120i8, 120i16.saturating_truncate());"
"assert_eq!(-120i8, (-120i16).saturating_truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Target
traits::TruncateTarget::internal_saturating_truncate(self);
"assert_eq!(Some(120i8), 120i16.checked_truncate());"
"assert_eq!(Some(-120i8), (-120i16).checked_truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Option<Target>
traits::TruncateTarget::internal_checked_truncate(self);
"assert_eq!(120i128, 120i8.extend());"
"assert_eq!(-120i128, (-120i8).extend());"
"this returns the extended value and does not modify the original"
Self
Target
Self
self
Target
traits::ExtendTarget::internal_extend(self);int_impl! {
367        Self = i16,
368        ActualT = i16,
369        UnsignedT = u16,
370        BITS = 16,
371        BITS_MINUS_ONE = 15,
372        Min = -32768,
373        Max = 32767,
374        rot = 4,
375        rot_op = "-0x5ffd",
376        rot_result = "0x3a",
377        swap_op = "0x1234",
378        swapped = "0x3412",
379        reversed = "0x2c48",
380        le_bytes = "[0x34, 0x12]",
381        be_bytes = "[0x12, 0x34]",
382        to_xe_bytes_doc = "",
383        from_xe_bytes_doc = "",
384        bound_condition = "",
385    }
386    "assert_eq!(0i16.midpoint(4), 2);"
"assert_eq!((-1i16).midpoint(2), 0);"
"assert_eq!((-7i16).midpoint(0), -3);"
"assert_eq!(0i16.midpoint(-7), -3);"
"assert_eq!(0i16.midpoint(7), 3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
((self as i32 + rhs as i32) / 2) as i16;midpoint_impl! { i16, i32, signed }
387}
388
389impl i32 {
390    "(&minus;2<sup>31</sup>)."
"assert_eq!(i32::MIN, -2147483648);"
Self
!Self::MAX
"(2<sup>31</sup> &minus; 1)."
"assert_eq!(i32::MAX, 2147483647);"
Self
(<u32>::MAX >> 1) as Self
"assert_eq!(i32::BITS, 32);"
u32
<u32>::BITS
"let n = 0b100_0000i32;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(self as u32).count_ones();
"assert_eq!(i32::MAX.count_zeros(), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(!self).count_ones();
"let n = -1i32;"
"[`ilog2`]: i32::ilog2"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(self as u32).leading_zeros();
"let n = -4i32;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(self as u32).trailing_zeros();
"let n = -1i32;"
"assert_eq!(n.leading_ones(), 32);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(self as u32).leading_ones();
"let n = 3i32;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(self as u32).trailing_ones();
"let n: i32 = 0b_01100100;"
"assert_eq!(0_i32.isolate_highest_one(), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
self & (((1 as i32) << (<i32>::BITS - 1)).wrapping_shr(self.leading_zeros()));
"let n: i32 = 0b_01100100;"
"assert_eq!(0_i32.isolate_lowest_one(), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
self & self.wrapping_neg();
"assert_eq!(0b0_i32.highest_one(), None);"
"assert_eq!(0b1_i32.highest_one(), Some(0));"
"assert_eq!(0b1_0000_i32.highest_one(), Some(4));"
"assert_eq!(0b1_1111_i32.highest_one(), Some(4));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
(self as u32).highest_one();
"assert_eq!(0b0_i32.lowest_one(), None);"
"assert_eq!(0b1_i32.lowest_one(), Some(0));"
"assert_eq!(0b1_0000_i32.lowest_one(), Some(4));"
"assert_eq!(0b1_1111_i32.lowest_one(), Some(0));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
(self as u32).lowest_one();
"let n = -1i32;"
"assert_eq!(n.cast_unsigned(), u32::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
self as u32;
"let n = 0x10000b3i32;"
"let m = 0xb301;"
"assert_eq!(n.rotate_left(8), m);"
"assert_eq!(n.rotate_left(1024), n);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
n
Self
(self as u32).rotate_left(n) as Self;
"let n = 0xb301i32;"
"let m = 0x10000b3;"
"assert_eq!(n.rotate_right(8), m);"
"assert_eq!(n.rotate_right(1024), n);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
n
Self
(self as u32).rotate_right(n) as Self;
"let n = 0x12345678i32;"
"assert_eq!(m, 0x78563412);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
(self as u32).swap_bytes() as Self;
"let n = 0x12345678i32;"
"assert_eq!(m, 0x1e6a2c48);"
"assert_eq!(0, 0i32.reverse_bits());"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
(self as u32).reverse_bits() as Self;
"let n = 0x1Ai32;"
"    assert_eq!(i32::from_be(n), n)"
"    assert_eq!(i32::from_be(n), n.swap_bytes())"
Self
x
Self
{ x.swap_bytes() }
"let n = 0x1Ai32;"
"    assert_eq!(i32::from_le(n), n)"
"    assert_eq!(i32::from_le(n), n.swap_bytes())"
Self
x
Self
{ x }
"`i32`."
"let n = 0x1Ai32;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
{ self.swap_bytes() }
"`i32`."
"let n = 0x1Ai32;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
{ self }
"assert_eq!((i32::MAX - 2).checked_add(1), Some(i32::MAX - 1));"
"assert_eq!((i32::MAX - 2).checked_add(3), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
let (a, b) = self.overflowing_add(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!((i32::MAX - 2).strict_add(1), i32::MAX - 1);"
"let _ = (i32::MAX - 2).strict_add(3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_add(rhs);
if b { imp::overflow_panic::add() } else { a }
"`self + rhs > i32::MAX` or `self + rhs < i32::MIN`,"
"[`checked_add`]: i32::checked_add"
"[`wrapping_add`]: i32::wrapping_add"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: i32, rhs: i32) {
        if !!lhs.overflowing_add(rhs).1 {
            let msg =
                "unsafe precondition(s) violated: i32::unchecked_add cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::unchecked_add(self, rhs) }
"assert_eq!(1i32.checked_add_unsigned(2), Some(3));"
"assert_eq!((i32::MAX - 2).checked_add_unsigned(3), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Option<Self>
let (a, b) = self.overflowing_add_unsigned(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!(1i32.strict_add_unsigned(2), 3);"
"let _ = (i32::MAX - 2).strict_add_unsigned(3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Self
let (a, b) = self.overflowing_add_unsigned(rhs);
if b { imp::overflow_panic::add() } else { a }
"assert_eq!((i32::MIN + 2).checked_sub(1), Some(i32::MIN + 1));"
"assert_eq!((i32::MIN + 2).checked_sub(3), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
let (a, b) = self.overflowing_sub(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!((i32::MIN + 2).strict_sub(1), i32::MIN + 1);"
"let _ = (i32::MIN + 2).strict_sub(3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_sub(rhs);
if b { imp::overflow_panic::sub() } else { a }
"`self - rhs > i32::MAX` or `self - rhs < i32::MIN`,"
"[`checked_sub`]: i32::checked_sub"
"[`wrapping_sub`]: i32::wrapping_sub"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: i32, rhs: i32) {
        if !!lhs.overflowing_sub(rhs).1 {
            let msg =
                "unsafe precondition(s) violated: i32::unchecked_sub cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::unchecked_sub(self, rhs) }
"assert_eq!(1i32.checked_sub_unsigned(2), Some(-1));"
"assert_eq!((i32::MIN + 2).checked_sub_unsigned(3), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Option<Self>
let (a, b) = self.overflowing_sub_unsigned(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!(1i32.strict_sub_unsigned(2), -1);"
"let _ = (i32::MIN + 2).strict_sub_unsigned(3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Self
let (a, b) = self.overflowing_sub_unsigned(rhs);
if b { imp::overflow_panic::sub() } else { a }
"assert_eq!(i32::MAX.checked_mul(1), Some(i32::MAX));"
"assert_eq!(i32::MAX.checked_mul(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
let (a, b) = self.overflowing_mul(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!(i32::MAX.strict_mul(1), i32::MAX);"
"let _ = i32::MAX.strict_mul(2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_mul(rhs);
if b { imp::overflow_panic::mul() } else { a }
"`self * rhs > i32::MAX` or `self * rhs < i32::MIN`,"
"[`checked_mul`]: i32::checked_mul"
"[`wrapping_mul`]: i32::wrapping_mul"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: i32, rhs: i32) {
        if !!lhs.overflowing_mul(rhs).1 {
            let msg =
                "unsafe precondition(s) violated: i32::unchecked_mul cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::unchecked_mul(self, rhs) }
"assert_eq!((i32::MIN + 1).checked_div(-1), Some(2147483647));"
"assert_eq!(i32::MIN.checked_div(-1), None);"
"assert_eq!((1i32).checked_div(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0 || ((self == Self::MIN) && (rhs == -1))) {
    None
} else { Some(unsafe { intrinsics::unchecked_div(self, rhs) }) }
"assert_eq!((i32::MIN + 1).strict_div(-1), 2147483647);"
"let _ = i32::MIN.strict_div(-1);"
"let _ = (1i32).strict_div(0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_div(rhs);
if b { imp::overflow_panic::div() } else { a }
"assert_eq!((i32::MIN + 1).checked_div_euclid(-1), Some(2147483647));"
"assert_eq!(i32::MIN.checked_div_euclid(-1), None);"
"assert_eq!((1i32).checked_div_euclid(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0 || ((self == Self::MIN) & (rhs == -1))) {
    None
} else { Some(self.div_euclid(rhs)) }
"assert_eq!((i32::MIN + 1).strict_div_euclid(-1), 2147483647);"
"let _ = i32::MIN.strict_div_euclid(-1);"
"let _ = (1i32).strict_div_euclid(0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_div_euclid(rhs);
if b { imp::overflow_panic::div() } else { a }
"assert_eq!((i32::MIN + 1).checked_div_exact(-1), Some(2147483647));"
"assert_eq!((-5i32).checked_div_exact(2), None);"
"assert_eq!(i32::MIN.checked_div_exact(-1), None);"
"assert_eq!((1i32).checked_div_exact(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0 || ((self == Self::MIN) && (rhs == -1))) {
    None
} else {
    unsafe {
        if intrinsics::unlikely(intrinsics::unchecked_rem(self, rhs) != 0) {
            None
        } else { Some(intrinsics::exact_div(self, rhs)) }
    }
}
"assert_eq!(64i32.div_exact(2), Some(32));"
"assert_eq!(64i32.div_exact(32), Some(2));"
"assert_eq!((i32::MIN + 1).div_exact(-1), Some(2147483647));"
"assert_eq!(65i32.div_exact(2), None);"
"let _ = 64i32.div_exact(0);"
"let _ = i32::MIN.div_exact(-1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if self % rhs != 0 { None } else { Some(self / rhs) }
"`self == i32::MIN && rhs == -1`,"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: i32, rhs: i32) {
        if !(rhs > 0 && lhs % rhs == 0 && (lhs != <i32>::MIN || rhs != -1)) {
            let msg =
                "unsafe precondition(s) violated: i32::unchecked_div_exact cannot overflow, divide by zero, or leave a remainder\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::exact_div(self, rhs) }
"assert_eq!(5i32.checked_rem(2), Some(1));"
"assert_eq!(5i32.checked_rem(0), None);"
"assert_eq!(i32::MIN.checked_rem(-1), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0 || ((self == Self::MIN) && (rhs == -1))) {
    None
} else { Some(unsafe { intrinsics::unchecked_rem(self, rhs) }) }
"assert_eq!(5i32.strict_rem(2), 1);"
"let _ = 5i32.strict_rem(0);"
"let _ = i32::MIN.strict_rem(-1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_rem(rhs);
if b { imp::overflow_panic::rem() } else { a }
"assert_eq!(5i32.checked_rem_euclid(2), Some(1));"
"assert_eq!(5i32.checked_rem_euclid(0), None);"
"assert_eq!(i32::MIN.checked_rem_euclid(-1), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0 || ((self == Self::MIN) & (rhs == -1))) {
    None
} else { Some(self.rem_euclid(rhs)) }
"assert_eq!(5i32.strict_rem_euclid(2), 1);"
"let _ = 5i32.strict_rem_euclid(0);"
"let _ = i32::MIN.strict_rem_euclid(-1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_rem_euclid(rhs);
if b { imp::overflow_panic::rem() } else { a }
"assert_eq!(5i32.checked_neg(), Some(-5));"
"assert_eq!(i32::MIN.checked_neg(), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<Self>
let (a, b) = self.overflowing_neg();
if intrinsics::unlikely(b) { None } else { Some(a) }
"`self == i32::MIN`,"
"[`checked_neg`]: i32::checked_neg"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: i32) {
        if !!lhs.overflowing_neg().1 {
            let msg =
                "unsafe precondition(s) violated: i32::unchecked_neg cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(self); }
};
unsafe { intrinsics::unchecked_sub(0, self) }
"assert_eq!(5i32.strict_neg(), -5);"
"let _ = i32::MIN.strict_neg();"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
let (a, b) = self.overflowing_neg();
if b { imp::overflow_panic::neg() } else { a }
"assert_eq!(0x1i32.checked_shl(4), Some(0x10));"
"assert_eq!(0x1i32.checked_shl(129), None);"
"assert_eq!(0x10i32.checked_shl(31), Some(0));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<Self>
if rhs < Self::BITS { Some(unsafe { self.unchecked_shl(rhs) }) } else { None }
"assert_eq!(0x1i32.strict_shl(4), 0x10);"
"let _ = 0x1i32.strict_shl(129);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
let (a, b) = self.overflowing_shl(rhs);
if b { imp::overflow_panic::shl() } else { a }
"[`checked_shl`]: i32::checked_shl"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(rhs: u32) {
        if !(rhs < <i32>::BITS) {
            let msg =
                "unsafe precondition(s) violated: i32::unchecked_shl cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(rhs); }
};
unsafe { intrinsics::unchecked_shl(self, rhs) }
"assert_eq!(0x1_i32.unbounded_shl(4), 0x10);"
"assert_eq!(0x1_i32.unbounded_shl(129), 0);"
"assert_eq!(0b101_i32.unbounded_shl(0), 0b101);"
"assert_eq!(0b101_i32.unbounded_shl(1), 0b1010);"
"assert_eq!(0b101_i32.unbounded_shl(2), 0b10100);"
"assert_eq!(42_i32.unbounded_shl(32), 0);"
"assert_eq!(42_i32.unbounded_shl(1).unbounded_shl(31), 0);"
"assert_eq!((-13_i32).unbounded_shl(32), 0);"
"assert_eq!((-13_i32).unbounded_shl(1).unbounded_shl(31), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
if rhs < Self::BITS { unsafe { self.unchecked_shl(rhs) } } else { 0 }
"`i32::BITS`."
"assert_eq!(0x1i32.shl_exact(4), Some(0x10));"
"assert_eq!(0x1i32.shl_exact(i32::BITS - 2), Some(1 << i32::BITS - 2));"
"assert_eq!(0x1i32.shl_exact(i32::BITS - 1), None);"
"assert_eq!((-0x2i32).shl_exact(i32::BITS - 2), Some(-0x2 << i32::BITS - 2));"
"assert_eq!((-0x2i32).shl_exact(i32::BITS - 1), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<i32>
if rhs < self.leading_zeros() || rhs < self.leading_ones() {
    Some(unsafe { self.unchecked_shl(rhs) })
} else { None }
"`i32::BITS`."
"[`i32::shl_exact`]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(zeros: u32, ones: u32, rhs: u32) {
        if !(rhs < zeros || rhs < ones) {
            let msg =
                "unsafe precondition(s) violated: i32::unchecked_shl_exact cannot shift out bits that would change the value of the first bit\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_library_ub() {
        precondition_check(self.leading_zeros(), self.leading_ones(), rhs);
    }
};
unsafe { self.unchecked_shl(rhs) }
"assert_eq!(0x10i32.checked_shr(4), Some(0x1));"
"assert_eq!(0x10i32.checked_shr(128), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<Self>
if rhs < Self::BITS { Some(unsafe { self.unchecked_shr(rhs) }) } else { None }
"assert_eq!(0x10i32.strict_shr(4), 0x1);"
"let _ = 0x10i32.strict_shr(128);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
let (a, b) = self.overflowing_shr(rhs);
if b { imp::overflow_panic::shr() } else { a }
"[`checked_shr`]: i32::checked_shr"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(rhs: u32) {
        if !(rhs < <i32>::BITS) {
            let msg =
                "unsafe precondition(s) violated: i32::unchecked_shr cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(rhs); }
};
unsafe { intrinsics::unchecked_shr(self, rhs) }
"assert_eq!(0x10_i32.unbounded_shr(4), 0x1);"
"assert_eq!(0x10_i32.unbounded_shr(129), 0);"
"assert_eq!(i32::MIN.unbounded_shr(129), -1);"
"assert_eq!(0b1010_i32.unbounded_shr(0), 0b1010);"
"assert_eq!(0b1010_i32.unbounded_shr(1), 0b101);"
"assert_eq!(0b1010_i32.unbounded_shr(2), 0b10);"
"assert_eq!(42_i32.unbounded_shr(32), 0);"
"assert_eq!(42_i32.unbounded_shr(1).unbounded_shr(31), 0);"
"assert_eq!((-13_i32).unbounded_shr(32), -1);"
"assert_eq!((-13_i32).unbounded_shr(1).unbounded_shr(31), -1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
if rhs < Self::BITS {
    unsafe { self.unchecked_shr(rhs) }
} else { unsafe { self.unchecked_shr(Self::BITS - 1) } }
"`i32::BITS`."
"assert_eq!(0x10i32.shr_exact(4), Some(0x1));"
"assert_eq!(0x10i32.shr_exact(5), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<i32>
if rhs <= self.trailing_zeros() && rhs < <i32>::BITS {
    Some(unsafe { self.unchecked_shr(rhs) })
} else { None }
"`i32::BITS`."
"i32::BITS`"
"[`i32::shr_exact`]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(zeros: u32, bits: u32, rhs: u32) {
        if !(rhs <= zeros && rhs < bits) {
            let msg =
                "unsafe precondition(s) violated: i32::unchecked_shr_exact cannot shift out non-zero bits\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_library_ub() {
        precondition_check(self.trailing_zeros(), <i32>::BITS, rhs);
    }
};
unsafe { self.unchecked_shr(rhs) }
"assert_eq!((-5i32).checked_abs(), Some(5));"
"assert_eq!(i32::MIN.checked_abs(), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<Self>
if self.is_negative() { self.checked_neg() } else { Some(self) }
"assert_eq!((-5i32).strict_abs(), 5);"
"let _ = i32::MIN.strict_abs();"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
if self.is_negative() { self.strict_neg() } else { self }
"assert_eq!(8i32.checked_pow(2), Some(64));"
"assert_eq!(0_i32.checked_pow(0), Some(1));"
"assert_eq!(i32::MAX.checked_pow(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Option<Self>
if exp == 0 { return Some(1); }
let mut base = self;
let mut acc: Self = 1;
loop {
    if (exp & 1) == 1 {
        acc =
            match acc.checked_mul(base) {
                Some(x) => x,
                None => return None,
            };
        if exp == 1 { return Some(acc); }
    }
    exp /= 2;
    base =
        match base.checked_mul(base) { Some(x) => x, None => return None, };
}
"assert_eq!(8i32.strict_pow(2), 64);"
"assert_eq!(0_i32.strict_pow(0), 1);"
"let _ = i32::MAX.strict_pow(2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Self
if exp == 0 { return 1; }
let mut base = self;
let mut acc: Self = 1;
loop {
    if (exp & 1) == 1 {
        acc = acc.strict_mul(base);
        if exp == 1 { return acc; }
    }
    exp /= 2;
    base = base.strict_mul(base);
}
"assert_eq!(10i32.checked_isqrt(), Some(3));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<Self>
if self < 0 {
    None
} else {
    let result = unsafe { imp::int_sqrt::i32(self as i32) as i32 };
    unsafe {
        const MAX_RESULT: i32 =
            unsafe { imp::int_sqrt::i32(<i32>::MAX) as i32 };
        crate::hint::assert_unchecked(result >= 0);
        crate::hint::assert_unchecked(result <= MAX_RESULT);
    }
    Some(result)
}
"assert_eq!(100i32.saturating_add(1), 101);"
"assert_eq!(i32::MAX.saturating_add(100), i32::MAX);"
"assert_eq!(i32::MIN.saturating_add(-1), i32::MIN);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::saturating_add(self, rhs);
"assert_eq!(1i32.saturating_add_unsigned(2), 3);"
"assert_eq!(i32::MAX.saturating_add_unsigned(100), i32::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Self
match self.checked_add_unsigned(rhs) { Some(x) => x, None => Self::MAX, }
"assert_eq!(100i32.saturating_sub(127), -27);"
"assert_eq!(i32::MIN.saturating_sub(100), i32::MIN);"
"assert_eq!(i32::MAX.saturating_sub(-1), i32::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::saturating_sub(self, rhs);
"assert_eq!(100i32.saturating_sub_unsigned(127), -27);"
"assert_eq!(i32::MIN.saturating_sub_unsigned(100), i32::MIN);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Self
match self.checked_sub_unsigned(rhs) { Some(x) => x, None => Self::MIN, }
"assert_eq!(100i32.saturating_neg(), -100);"
"assert_eq!((-100i32).saturating_neg(), 100);"
"assert_eq!(i32::MIN.saturating_neg(), i32::MAX);"
"assert_eq!(i32::MAX.saturating_neg(), i32::MIN + 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
intrinsics::saturating_sub(0, self);
"assert_eq!(100i32.saturating_abs(), 100);"
"assert_eq!((-100i32).saturating_abs(), 100);"
"assert_eq!(i32::MIN.saturating_abs(), i32::MAX);"
"assert_eq!((i32::MIN + 1).saturating_abs(), i32::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
if self.is_negative() { self.saturating_neg() } else { self }
"assert_eq!(10i32.saturating_mul(12), 120);"
"assert_eq!(i32::MAX.saturating_mul(10), i32::MAX);"
"assert_eq!(i32::MIN.saturating_mul(10), i32::MIN);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
match self.checked_mul(rhs) {
    Some(x) => x,
    None => if (self < 0) == (rhs < 0) { Self::MAX } else { Self::MIN },
}
"assert_eq!(5i32.saturating_div(2), 2);"
"assert_eq!(i32::MAX.saturating_div(-1), i32::MIN + 1);"
"assert_eq!(i32::MIN.saturating_div(-1), i32::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
match self.overflowing_div(rhs) {
    (result, false) => result,
    (_result, true) => Self::MAX,
}
"assert_eq!((-4i32).saturating_pow(3), -64);"
"assert_eq!(0_i32.saturating_pow(0), 1);"
"assert_eq!(i32::MIN.saturating_pow(2), i32::MAX);"
"assert_eq!(i32::MIN.saturating_pow(3), i32::MIN);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
exp
Self
match self.checked_pow(exp) {
    Some(x) => x,
    None if self < 0 && exp % 2 == 1 => Self::MIN,
    None => Self::MAX,
}
"assert_eq!(100i32.wrapping_add(27), 127);"
"assert_eq!(i32::MAX.wrapping_add(2), i32::MIN + 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::wrapping_add(self, rhs);
"assert_eq!(100i32.wrapping_add_unsigned(27), 127);"
"assert_eq!(i32::MAX.wrapping_add_unsigned(2), i32::MIN + 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Self
self.wrapping_add(rhs as Self);
"assert_eq!(0i32.wrapping_sub(127), -127);"
"assert_eq!((-2i32).wrapping_sub(i32::MAX), i32::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::wrapping_sub(self, rhs);
"assert_eq!(0i32.wrapping_sub_unsigned(127), -127);"
"assert_eq!((-2i32).wrapping_sub_unsigned(u32::MAX), -1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Self
self.wrapping_sub(rhs as Self);
"assert_eq!(10i32.wrapping_mul(12), 120);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::wrapping_mul(self, rhs);
"assert_eq!(100i32.wrapping_div(10), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self.overflowing_div(rhs).0;
"assert_eq!(100i32.wrapping_div_euclid(10), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self.overflowing_div_euclid(rhs).0;
"assert_eq!(100i32.wrapping_rem(10), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self.overflowing_rem(rhs).0;
"assert_eq!(100i32.wrapping_rem_euclid(10), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self.overflowing_rem_euclid(rhs).0;
"assert_eq!(100i32.wrapping_neg(), -100);"
"assert_eq!((-100i32).wrapping_neg(), 100);"
"assert_eq!(i32::MIN.wrapping_neg(), i32::MIN);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
(0 as i32).wrapping_sub(self);
"assert_eq!((-1_i32).wrapping_shl(7), -128);"
"assert_eq!(42_i32.wrapping_shl(32), 42);"
"assert_eq!(42_i32.wrapping_shl(1).wrapping_shl(31), 0);"
"assert_eq!((-1_i32).wrapping_shl(128), -1);"
"assert_eq!(5_i32.wrapping_shl(1025), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
unsafe { self.unchecked_shl(rhs & (Self::BITS - 1)) }
"assert_eq!((-128_i32).wrapping_shr(7), -1);"
"assert_eq!(42_i32.wrapping_shr(32), 42);"
"assert_eq!(42_i32.wrapping_shr(1).wrapping_shr(31), 0);"
"assert_eq!(10_i32.wrapping_shr(1025), 5);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
unsafe { self.unchecked_shr(rhs & (Self::BITS - 1)) }
"assert_eq!(100i32.wrapping_abs(), 100);"
"assert_eq!((-100i32).wrapping_abs(), 100);"
"assert_eq!(i32::MIN.wrapping_abs(), i32::MIN);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
if self.is_negative() { self.wrapping_neg() } else { self }
"assert_eq!(100i32.unsigned_abs(), 100u32);"
"assert_eq!((-100i32).unsigned_abs(), 100u32);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
self.wrapping_abs() as u32;
"assert_eq!(3i32.wrapping_pow(4), 81);"
"assert_eq!(0_i32.wrapping_pow(0), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Self
if exp == 0 { return 1; }
let mut base = self;
let mut acc: Self = 1;
if intrinsics::is_val_statically_known(exp) {
    while exp > 1 {
        if (exp & 1) == 1 { acc = acc.wrapping_mul(base); }
        exp /= 2;
        base = base.wrapping_mul(base);
    }
    acc.wrapping_mul(base)
} else {
    loop {
        if (exp & 1) == 1 {
            acc = acc.wrapping_mul(base);
            if exp == 1 { return acc; }
        }
        exp /= 2;
        base = base.wrapping_mul(base);
    }
}
"assert_eq!(5i32.overflowing_add(2), (7, false));"
"assert_eq!(i32::MAX.overflowing_add(1), (i32::MIN, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
let (a, b) = intrinsics::add_with_overflow(self as i32, rhs as i32);
(a as Self, b);
"[`u32::carrying_add`]"
"//   10  MAX    (a = 10 \u{d7} 2^32 + 2^32 - 1)"
"// + -5    9    (b = -5 \u{d7} 2^32 + 9)"
"//    6    8    (sum = 6 \u{d7} 2^32 + 8)"
"let (a1, a0): (i32, u32) = (10, u32::MAX);"
"let (b1, b0): (i32, u32) = (-5, 9);"
"// u32::carrying_add for the less significant words"
"// i32::carrying_add for the most significant word"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
bool
carry
(Self, bool)
let (a, b) = self.overflowing_add(rhs);
let (c, d) = a.overflowing_add(carry as i32);
(c, b != d);
"assert_eq!(1i32.overflowing_add_unsigned(2), (3, false));"
"assert_eq!((i32::MIN).overflowing_add_unsigned(u32::MAX), (i32::MAX, false));"
"assert_eq!((i32::MAX - 2).overflowing_add_unsigned(3), (i32::MIN, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
(Self, bool)
let rhs = rhs as Self;
let (res, overflowed) = self.overflowing_add(rhs);
(res, overflowed ^ (rhs < 0));
"assert_eq!(5i32.overflowing_sub(2), (3, false));"
"assert_eq!(i32::MIN.overflowing_sub(1), (i32::MAX, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
let (a, b) = intrinsics::sub_with_overflow(self as i32, rhs as i32);
(a as Self, b);
"[`u32::borrowing_sub`]"
"//    6    8    (a = 6 \u{d7} 2^32 + 8)"
"// - -5    9    (b = -5 \u{d7} 2^32 + 9)"
"//   10  MAX    (diff = 10 \u{d7} 2^32 + 2^32 - 1)"
"let (a1, a0): (i32, u32) = (6, 8);"
"let (b1, b0): (i32, u32) = (-5, 9);"
"// u32::borrowing_sub for the less significant words"
"// i32::borrowing_sub for the most significant word"
"assert_eq!((diff1, diff0), (10, u32::MAX));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
bool
borrow
(Self, bool)
let (a, b) = self.overflowing_sub(rhs);
let (c, d) = a.overflowing_sub(borrow as i32);
(c, b != d);
"assert_eq!(1i32.overflowing_sub_unsigned(2), (-1, false));"
"assert_eq!((i32::MAX).overflowing_sub_unsigned(u32::MAX), (i32::MIN, false));"
"assert_eq!((i32::MIN + 2).overflowing_sub_unsigned(3), (i32::MAX, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
(Self, bool)
let rhs = rhs as Self;
let (res, overflowed) = self.overflowing_sub(rhs);
(res, overflowed ^ (rhs < 0));
"assert_eq!(5i32.overflowing_mul(2), (10, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
let (a, b) = intrinsics::mul_with_overflow(self as i32, rhs as i32);
(a as Self, b);
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(u32, Self)
Self::carrying_mul_add(self, rhs, 0, 0);
"assert_eq!(i32::MAX.carrying_mul(i32::MAX, i32::MAX), (i32::MAX.unsigned_abs() + 1, i32::MAX / 2));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
carry
(u32, Self)
Self::carrying_mul_add(self, rhs, carry, 0);
"assert_eq!(i32::MAX.carrying_mul_add(i32::MAX, i32::MAX, i32::MAX), (u32::MAX, i32::MAX / 2));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
carry
Self
add
(u32, Self)
intrinsics::carrying_mul_add(self, rhs, carry, add);
"assert_eq!(5i32.overflowing_div(2), (2, false));"
"assert_eq!(i32::MIN.overflowing_div(-1), (i32::MIN, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
if intrinsics::unlikely((self == Self::MIN) & (rhs == -1)) {
    (self, true)
} else { (self / rhs, false) }
"assert_eq!(5i32.overflowing_div_euclid(2), (2, false));"
"assert_eq!(i32::MIN.overflowing_div_euclid(-1), (i32::MIN, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
if intrinsics::unlikely((self == Self::MIN) & (rhs == -1)) {
    (self, true)
} else { (self.div_euclid(rhs), false) }
"assert_eq!(5i32.overflowing_rem(2), (1, false));"
"assert_eq!(i32::MIN.overflowing_rem(-1), (0, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
if intrinsics::unlikely(rhs == -1) {
    (0, self == Self::MIN)
} else { (self % rhs, false) }
"assert_eq!(5i32.overflowing_rem_euclid(2), (1, false));"
"assert_eq!(i32::MIN.overflowing_rem_euclid(-1), (0, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
if intrinsics::unlikely(rhs == -1) {
    (0, self == Self::MIN)
} else { (self.rem_euclid(rhs), false) }
"assert_eq!(2i32.overflowing_neg(), (-2, false));"
"assert_eq!(i32::MIN.overflowing_neg(), (i32::MIN, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
(Self, bool)
if intrinsics::unlikely(self == Self::MIN) {
    (Self::MIN, true)
} else { (-self, false) }
"assert_eq!(0x1i32.overflowing_shl(4), (0x10, false));"
"assert_eq!(0x10i32.overflowing_shl(31), (0, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
(Self, bool)
(self.wrapping_shl(rhs), rhs >= Self::BITS);
"assert_eq!(0x10i32.overflowing_shr(4), (0x1, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
(Self, bool)
(self.wrapping_shr(rhs), rhs >= Self::BITS);
"(e.g., i32::MIN for values of type i32),"
"assert_eq!(10i32.overflowing_abs(), (10, false));"
"assert_eq!((-10i32).overflowing_abs(), (10, false));"
"assert_eq!((i32::MIN).overflowing_abs(), (i32::MIN, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
(Self, bool)
(self.wrapping_abs(), self == Self::MIN);
"assert_eq!(3i32.overflowing_pow(4), (81, false));"
"assert_eq!(0_i32.overflowing_pow(0), (1, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
(Self, bool)
if exp == 0 { return (1, false); }
let mut base = self;
let mut acc: Self = 1;
let mut overflown = false;
let mut r;
loop {
    if (exp & 1) == 1 {
        r = acc.overflowing_mul(base);
        if exp == 1 { r.1 |= overflown; return r; }
        acc = r.0;
        overflown |= r.1;
    }
    exp /= 2;
    r = base.overflowing_mul(base);
    base = r.0;
    overflown |= r.1;
}
"let x: i32 = 2; // or any other integer type"
"assert_eq!(0_i32.pow(0), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Self
if exp == 0 { return 1; }
let mut base = self;
let mut acc = 1;
if intrinsics::is_val_statically_known(exp) {
    while exp > 1 {
        if (exp & 1) == 1 { acc = acc * base; }
        exp /= 2;
        base = base * base;
    }
    acc * base
} else {
    loop {
        if (exp & 1) == 1 { acc = acc * base; if exp == 1 { return acc; } }
        exp /= 2;
        base = base * base;
    }
}
"assert_eq!(10i32.isqrt(), 3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
match self.checked_isqrt() {
    Some(sqrt) => sqrt,
    None => imp::int_sqrt::panic_for_negative_argument(),
}
"let a: i32 = 7; // or any other integer type"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let q = self / rhs;
if self % rhs < 0 { return if rhs > 0 { q - 1 } else { q + 1 } }
q;
"let a: i32 = 7; // or any other integer type"
"let _ = i32::MIN.rem_euclid(-1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let r = self % rhs;
if r < 0 { r.wrapping_add(rhs.wrapping_abs()) } else { r }
"let a: i32 = 8;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let d = self / rhs;
let r = self % rhs;
let correction = (self ^ rhs) >> (Self::BITS - 1);
if r != 0 { d + correction } else { d }
"let a: i32 = 8;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let d = self / rhs;
let r = self % rhs;
let correction = 1 + ((self ^ rhs) >> (Self::BITS - 1));
if r != 0 { d + correction } else { d }
"assert_eq!(16_i32.next_multiple_of(8), 16);"
"assert_eq!(23_i32.next_multiple_of(8), 24);"
"assert_eq!(16_i32.next_multiple_of(-8), 16);"
"assert_eq!(23_i32.next_multiple_of(-8), 16);"
"assert_eq!((-16_i32).next_multiple_of(8), -16);"
"assert_eq!((-23_i32).next_multiple_of(8), -16);"
"assert_eq!((-16_i32).next_multiple_of(-8), -16);"
"assert_eq!((-23_i32).next_multiple_of(-8), -24);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
if rhs == -1 { return self; }
let r = self % rhs;
let m = if (r > 0 && rhs < 0) || (r < 0 && rhs > 0) { r + rhs } else { r };
if m == 0 { self } else { self + (rhs - m) }
"assert_eq!(16_i32.checked_next_multiple_of(8), Some(16));"
"assert_eq!(23_i32.checked_next_multiple_of(8), Some(24));"
"assert_eq!(16_i32.checked_next_multiple_of(-8), Some(16));"
"assert_eq!(23_i32.checked_next_multiple_of(-8), Some(16));"
"assert_eq!((-16_i32).checked_next_multiple_of(8), Some(-16));"
"assert_eq!((-23_i32).checked_next_multiple_of(8), Some(-16));"
"assert_eq!((-16_i32).checked_next_multiple_of(-8), Some(-16));"
"assert_eq!((-23_i32).checked_next_multiple_of(-8), Some(-24));"
"assert_eq!(1_i32.checked_next_multiple_of(0), None);"
"assert_eq!(i32::MAX.checked_next_multiple_of(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if rhs == -1 { return Some(self); }
let r = match self.checked_rem(rhs) { Some(x) => x, None => return None, };
let m = if (r > 0 && rhs < 0) || (r < 0 && rhs > 0) { r + rhs } else { r };
if m == 0 { Some(self) } else { self.checked_add(rhs - m) }
"assert_eq!(5i32.ilog(5), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
base
u32
if !(base >= 2) {
    {
        crate::panicking::panic_fmt(format_args!("base of integer logarithm must be at least 2"));
    }
};
if let Some(log) = self.checked_ilog(base) {
    log
} else { imp::int_log10::panic_for_nonpositive_argument() }
"assert_eq!(2i32.ilog2(), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
if let Some(log) = self.checked_ilog2() {
    log
} else { imp::int_log10::panic_for_nonpositive_argument() }
"assert_eq!(10i32.ilog10(), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
if let Some(log) = self.checked_ilog10() {
    log
} else { imp::int_log10::panic_for_nonpositive_argument() }
"assert_eq!(5i32.checked_ilog(5), Some(1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
base
Option<u32>
if self <= 0 || base <= 1 {
    None
} else { (self as u32).checked_ilog(base as u32) }
"assert_eq!(2i32.checked_ilog2(), Some(1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
if self <= 0 {
    None
} else {
    let log =
        (Self::BITS - 1) - unsafe { intrinsics::ctlz_nonzero(self) as u32 };
    Some(log)
}
"assert_eq!(10i32.checked_ilog10(), Some(1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
imp::int_log10::i32(self as i32);
"`i32::MIN`"
"`i32`,"
"`i32::MIN`"
"assert_eq!(10i32.abs(), 10);"
"assert_eq!((-10i32).abs(), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
if self.is_negative() { -self } else { self }
"assert_eq!(100i32.abs_diff(80), 20u32);"
"assert_eq!(100i32.abs_diff(110), 10u32);"
"assert_eq!((-100i32).abs_diff(80), 180u32);"
"assert_eq!((-100i32).abs_diff(-120), 20u32);"
"assert_eq!(i32::MIN.abs_diff(i32::MAX), u32::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
other
if self < other {
    (other as u32).wrapping_sub(self as u32)
} else { (self as u32).wrapping_sub(other as u32) }
"assert_eq!(10i32.signum(), 1);"
"assert_eq!(0i32.signum(), 0);"
"assert_eq!((-10i32).signum(), -1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
crate::intrinsics::three_way_compare(self, 0) as Self;
"assert!(10i32.is_positive());"
"assert!(!(-10i32).is_positive());"
Self
self
bool
self > 0;
"assert!((-10i32).is_negative());"
"assert!(!10i32.is_negative());"
Self
self
bool
self < 0;
"let bytes = 0x12345678i32.to_be_bytes();"
"assert_eq!(bytes, [0x12, 0x34, 0x56, 0x78]);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
self.to_be().to_ne_bytes();
"let bytes = 0x12345678i32.to_le_bytes();"
"assert_eq!(bytes, [0x78, 0x56, 0x34, 0x12]);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
self.to_le().to_ne_bytes();
"let bytes = 0x12345678i32.to_ne_bytes();"
"        [0x12, 0x34, 0x56, 0x78]"
"        [0x78, 0x56, 0x34, 0x12]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
unsafe { mem::transmute(self) }
"let value = i32::from_be_bytes([0x12, 0x34, 0x56, 0x78]);"
"assert_eq!(value, 0x12345678);"
"fn read_be_i32(input: &mut &[u8]) -> i32 {"
"    let (int_bytes, rest) = input.split_at(size_of::<i32>());"
"    i32::from_be_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
Self::from_be(Self::from_ne_bytes(bytes));
"let value = i32::from_le_bytes([0x78, 0x56, 0x34, 0x12]);"
"assert_eq!(value, 0x12345678);"
"fn read_le_i32(input: &mut &[u8]) -> i32 {"
"    let (int_bytes, rest) = input.split_at(size_of::<i32>());"
"    i32::from_le_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
Self::from_le(Self::from_ne_bytes(bytes));
"let value = i32::from_ne_bytes(if cfg!(target_endian = \"big\") {"
"    [0x12, 0x34, 0x56, 0x78]"
"    [0x78, 0x56, 0x34, 0x12]"
"assert_eq!(value, 0x12345678);"
"fn read_ne_i32(input: &mut &[u8]) -> i32 {"
"    let (int_bytes, rest) = input.split_at(size_of::<i32>());"
"    i32::from_ne_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
unsafe { mem::transmute(bytes) }
"[`i32::MIN`] instead."
"i32_legacy_fn_min_value"
Self
Self::MIN;
"[`i32::MAX`] instead."
"i32_legacy_fn_max_value"
Self
Self::MAX;
"assert_eq!(120i32.clamp_magnitude(100), 100);"
"assert_eq!(-120i32.clamp_magnitude(100), -100);"
"assert_eq!(80i32.clamp_magnitude(100), 80);"
"assert_eq!(-80i32.clamp_magnitude(100), -80);"
"this returns the clamped value and does not modify the original"
Self
self
limit
Self
if let Ok(limit) = core::convert::TryInto::<i32>::try_into(limit) {
    self.clamp(-limit, limit)
} else { self }
"assert_eq!(120i8, 120i32.truncate());"
"assert_eq!(-120i8, (-120i32).truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Target
traits::TruncateTarget::internal_truncate(self);
"assert_eq!(120i8, 120i32.saturating_truncate());"
"assert_eq!(-120i8, (-120i32).saturating_truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Target
traits::TruncateTarget::internal_saturating_truncate(self);
"assert_eq!(Some(120i8), 120i32.checked_truncate());"
"assert_eq!(Some(-120i8), (-120i32).checked_truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Option<Target>
traits::TruncateTarget::internal_checked_truncate(self);
"assert_eq!(120i128, 120i8.extend());"
"assert_eq!(-120i128, (-120i8).extend());"
"this returns the extended value and does not modify the original"
Self
Target
Self
self
Target
traits::ExtendTarget::internal_extend(self);int_impl! {
391        Self = i32,
392        ActualT = i32,
393        UnsignedT = u32,
394        BITS = 32,
395        BITS_MINUS_ONE = 31,
396        Min = -2147483648,
397        Max = 2147483647,
398        rot = 8,
399        rot_op = "0x10000b3",
400        rot_result = "0xb301",
401        swap_op = "0x12345678",
402        swapped = "0x78563412",
403        reversed = "0x1e6a2c48",
404        le_bytes = "[0x78, 0x56, 0x34, 0x12]",
405        be_bytes = "[0x12, 0x34, 0x56, 0x78]",
406        to_xe_bytes_doc = "",
407        from_xe_bytes_doc = "",
408        bound_condition = "",
409    }
410    "assert_eq!(0i32.midpoint(4), 2);"
"assert_eq!((-1i32).midpoint(2), 0);"
"assert_eq!((-7i32).midpoint(0), -3);"
"assert_eq!(0i32.midpoint(-7), -3);"
"assert_eq!(0i32.midpoint(7), 3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
((self as i64 + rhs as i64) / 2) as i32;midpoint_impl! { i32, i64, signed }
411}
412
413impl i64 {
414    "(&minus;2<sup>63</sup>)."
"assert_eq!(i64::MIN, -9223372036854775808);"
Self
!Self::MAX
"(2<sup>63</sup> &minus; 1)."
"assert_eq!(i64::MAX, 9223372036854775807);"
Self
(<u64>::MAX >> 1) as Self
"assert_eq!(i64::BITS, 64);"
u32
<u64>::BITS
"let n = 0b100_0000i64;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(self as u64).count_ones();
"assert_eq!(i64::MAX.count_zeros(), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(!self).count_ones();
"let n = -1i64;"
"[`ilog2`]: i64::ilog2"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(self as u64).leading_zeros();
"let n = -4i64;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(self as u64).trailing_zeros();
"let n = -1i64;"
"assert_eq!(n.leading_ones(), 64);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(self as u64).leading_ones();
"let n = 3i64;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(self as u64).trailing_ones();
"let n: i64 = 0b_01100100;"
"assert_eq!(0_i64.isolate_highest_one(), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
self & (((1 as i64) << (<i64>::BITS - 1)).wrapping_shr(self.leading_zeros()));
"let n: i64 = 0b_01100100;"
"assert_eq!(0_i64.isolate_lowest_one(), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
self & self.wrapping_neg();
"assert_eq!(0b0_i64.highest_one(), None);"
"assert_eq!(0b1_i64.highest_one(), Some(0));"
"assert_eq!(0b1_0000_i64.highest_one(), Some(4));"
"assert_eq!(0b1_1111_i64.highest_one(), Some(4));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
(self as u64).highest_one();
"assert_eq!(0b0_i64.lowest_one(), None);"
"assert_eq!(0b1_i64.lowest_one(), Some(0));"
"assert_eq!(0b1_0000_i64.lowest_one(), Some(4));"
"assert_eq!(0b1_1111_i64.lowest_one(), Some(0));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
(self as u64).lowest_one();
"let n = -1i64;"
"assert_eq!(n.cast_unsigned(), u64::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
self as u64;
"let n = 0xaa00000000006e1i64;"
"let m = 0x6e10aa;"
"assert_eq!(n.rotate_left(12), m);"
"assert_eq!(n.rotate_left(1024), n);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
n
Self
(self as u64).rotate_left(n) as Self;
"let n = 0x6e10aai64;"
"let m = 0xaa00000000006e1;"
"assert_eq!(n.rotate_right(12), m);"
"assert_eq!(n.rotate_right(1024), n);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
n
Self
(self as u64).rotate_right(n) as Self;
"let n = 0x1234567890123456i64;"
"assert_eq!(m, 0x5634129078563412);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
(self as u64).swap_bytes() as Self;
"let n = 0x1234567890123456i64;"
"assert_eq!(m, 0x6a2c48091e6a2c48);"
"assert_eq!(0, 0i64.reverse_bits());"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
(self as u64).reverse_bits() as Self;
"let n = 0x1Ai64;"
"    assert_eq!(i64::from_be(n), n)"
"    assert_eq!(i64::from_be(n), n.swap_bytes())"
Self
x
Self
{ x.swap_bytes() }
"let n = 0x1Ai64;"
"    assert_eq!(i64::from_le(n), n)"
"    assert_eq!(i64::from_le(n), n.swap_bytes())"
Self
x
Self
{ x }
"`i64`."
"let n = 0x1Ai64;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
{ self.swap_bytes() }
"`i64`."
"let n = 0x1Ai64;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
{ self }
"assert_eq!((i64::MAX - 2).checked_add(1), Some(i64::MAX - 1));"
"assert_eq!((i64::MAX - 2).checked_add(3), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
let (a, b) = self.overflowing_add(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!((i64::MAX - 2).strict_add(1), i64::MAX - 1);"
"let _ = (i64::MAX - 2).strict_add(3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_add(rhs);
if b { imp::overflow_panic::add() } else { a }
"`self + rhs > i64::MAX` or `self + rhs < i64::MIN`,"
"[`checked_add`]: i64::checked_add"
"[`wrapping_add`]: i64::wrapping_add"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: i64, rhs: i64) {
        if !!lhs.overflowing_add(rhs).1 {
            let msg =
                "unsafe precondition(s) violated: i64::unchecked_add cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::unchecked_add(self, rhs) }
"assert_eq!(1i64.checked_add_unsigned(2), Some(3));"
"assert_eq!((i64::MAX - 2).checked_add_unsigned(3), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Option<Self>
let (a, b) = self.overflowing_add_unsigned(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!(1i64.strict_add_unsigned(2), 3);"
"let _ = (i64::MAX - 2).strict_add_unsigned(3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Self
let (a, b) = self.overflowing_add_unsigned(rhs);
if b { imp::overflow_panic::add() } else { a }
"assert_eq!((i64::MIN + 2).checked_sub(1), Some(i64::MIN + 1));"
"assert_eq!((i64::MIN + 2).checked_sub(3), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
let (a, b) = self.overflowing_sub(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!((i64::MIN + 2).strict_sub(1), i64::MIN + 1);"
"let _ = (i64::MIN + 2).strict_sub(3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_sub(rhs);
if b { imp::overflow_panic::sub() } else { a }
"`self - rhs > i64::MAX` or `self - rhs < i64::MIN`,"
"[`checked_sub`]: i64::checked_sub"
"[`wrapping_sub`]: i64::wrapping_sub"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: i64, rhs: i64) {
        if !!lhs.overflowing_sub(rhs).1 {
            let msg =
                "unsafe precondition(s) violated: i64::unchecked_sub cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::unchecked_sub(self, rhs) }
"assert_eq!(1i64.checked_sub_unsigned(2), Some(-1));"
"assert_eq!((i64::MIN + 2).checked_sub_unsigned(3), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Option<Self>
let (a, b) = self.overflowing_sub_unsigned(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!(1i64.strict_sub_unsigned(2), -1);"
"let _ = (i64::MIN + 2).strict_sub_unsigned(3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Self
let (a, b) = self.overflowing_sub_unsigned(rhs);
if b { imp::overflow_panic::sub() } else { a }
"assert_eq!(i64::MAX.checked_mul(1), Some(i64::MAX));"
"assert_eq!(i64::MAX.checked_mul(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
let (a, b) = self.overflowing_mul(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!(i64::MAX.strict_mul(1), i64::MAX);"
"let _ = i64::MAX.strict_mul(2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_mul(rhs);
if b { imp::overflow_panic::mul() } else { a }
"`self * rhs > i64::MAX` or `self * rhs < i64::MIN`,"
"[`checked_mul`]: i64::checked_mul"
"[`wrapping_mul`]: i64::wrapping_mul"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: i64, rhs: i64) {
        if !!lhs.overflowing_mul(rhs).1 {
            let msg =
                "unsafe precondition(s) violated: i64::unchecked_mul cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::unchecked_mul(self, rhs) }
"assert_eq!((i64::MIN + 1).checked_div(-1), Some(9223372036854775807));"
"assert_eq!(i64::MIN.checked_div(-1), None);"
"assert_eq!((1i64).checked_div(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0 || ((self == Self::MIN) && (rhs == -1))) {
    None
} else { Some(unsafe { intrinsics::unchecked_div(self, rhs) }) }
"assert_eq!((i64::MIN + 1).strict_div(-1), 9223372036854775807);"
"let _ = i64::MIN.strict_div(-1);"
"let _ = (1i64).strict_div(0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_div(rhs);
if b { imp::overflow_panic::div() } else { a }
"assert_eq!((i64::MIN + 1).checked_div_euclid(-1), Some(9223372036854775807));"
"assert_eq!(i64::MIN.checked_div_euclid(-1), None);"
"assert_eq!((1i64).checked_div_euclid(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0 || ((self == Self::MIN) & (rhs == -1))) {
    None
} else { Some(self.div_euclid(rhs)) }
"assert_eq!((i64::MIN + 1).strict_div_euclid(-1), 9223372036854775807);"
"let _ = i64::MIN.strict_div_euclid(-1);"
"let _ = (1i64).strict_div_euclid(0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_div_euclid(rhs);
if b { imp::overflow_panic::div() } else { a }
"assert_eq!((i64::MIN + 1).checked_div_exact(-1), Some(9223372036854775807));"
"assert_eq!((-5i64).checked_div_exact(2), None);"
"assert_eq!(i64::MIN.checked_div_exact(-1), None);"
"assert_eq!((1i64).checked_div_exact(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0 || ((self == Self::MIN) && (rhs == -1))) {
    None
} else {
    unsafe {
        if intrinsics::unlikely(intrinsics::unchecked_rem(self, rhs) != 0) {
            None
        } else { Some(intrinsics::exact_div(self, rhs)) }
    }
}
"assert_eq!(64i64.div_exact(2), Some(32));"
"assert_eq!(64i64.div_exact(32), Some(2));"
"assert_eq!((i64::MIN + 1).div_exact(-1), Some(9223372036854775807));"
"assert_eq!(65i64.div_exact(2), None);"
"let _ = 64i64.div_exact(0);"
"let _ = i64::MIN.div_exact(-1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if self % rhs != 0 { None } else { Some(self / rhs) }
"`self == i64::MIN && rhs == -1`,"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: i64, rhs: i64) {
        if !(rhs > 0 && lhs % rhs == 0 && (lhs != <i64>::MIN || rhs != -1)) {
            let msg =
                "unsafe precondition(s) violated: i64::unchecked_div_exact cannot overflow, divide by zero, or leave a remainder\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::exact_div(self, rhs) }
"assert_eq!(5i64.checked_rem(2), Some(1));"
"assert_eq!(5i64.checked_rem(0), None);"
"assert_eq!(i64::MIN.checked_rem(-1), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0 || ((self == Self::MIN) && (rhs == -1))) {
    None
} else { Some(unsafe { intrinsics::unchecked_rem(self, rhs) }) }
"assert_eq!(5i64.strict_rem(2), 1);"
"let _ = 5i64.strict_rem(0);"
"let _ = i64::MIN.strict_rem(-1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_rem(rhs);
if b { imp::overflow_panic::rem() } else { a }
"assert_eq!(5i64.checked_rem_euclid(2), Some(1));"
"assert_eq!(5i64.checked_rem_euclid(0), None);"
"assert_eq!(i64::MIN.checked_rem_euclid(-1), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0 || ((self == Self::MIN) & (rhs == -1))) {
    None
} else { Some(self.rem_euclid(rhs)) }
"assert_eq!(5i64.strict_rem_euclid(2), 1);"
"let _ = 5i64.strict_rem_euclid(0);"
"let _ = i64::MIN.strict_rem_euclid(-1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_rem_euclid(rhs);
if b { imp::overflow_panic::rem() } else { a }
"assert_eq!(5i64.checked_neg(), Some(-5));"
"assert_eq!(i64::MIN.checked_neg(), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<Self>
let (a, b) = self.overflowing_neg();
if intrinsics::unlikely(b) { None } else { Some(a) }
"`self == i64::MIN`,"
"[`checked_neg`]: i64::checked_neg"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: i64) {
        if !!lhs.overflowing_neg().1 {
            let msg =
                "unsafe precondition(s) violated: i64::unchecked_neg cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(self); }
};
unsafe { intrinsics::unchecked_sub(0, self) }
"assert_eq!(5i64.strict_neg(), -5);"
"let _ = i64::MIN.strict_neg();"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
let (a, b) = self.overflowing_neg();
if b { imp::overflow_panic::neg() } else { a }
"assert_eq!(0x1i64.checked_shl(4), Some(0x10));"
"assert_eq!(0x1i64.checked_shl(129), None);"
"assert_eq!(0x10i64.checked_shl(63), Some(0));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<Self>
if rhs < Self::BITS { Some(unsafe { self.unchecked_shl(rhs) }) } else { None }
"assert_eq!(0x1i64.strict_shl(4), 0x10);"
"let _ = 0x1i64.strict_shl(129);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
let (a, b) = self.overflowing_shl(rhs);
if b { imp::overflow_panic::shl() } else { a }
"[`checked_shl`]: i64::checked_shl"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(rhs: u32) {
        if !(rhs < <i64>::BITS) {
            let msg =
                "unsafe precondition(s) violated: i64::unchecked_shl cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(rhs); }
};
unsafe { intrinsics::unchecked_shl(self, rhs) }
"assert_eq!(0x1_i64.unbounded_shl(4), 0x10);"
"assert_eq!(0x1_i64.unbounded_shl(129), 0);"
"assert_eq!(0b101_i64.unbounded_shl(0), 0b101);"
"assert_eq!(0b101_i64.unbounded_shl(1), 0b1010);"
"assert_eq!(0b101_i64.unbounded_shl(2), 0b10100);"
"assert_eq!(42_i64.unbounded_shl(64), 0);"
"assert_eq!(42_i64.unbounded_shl(1).unbounded_shl(63), 0);"
"assert_eq!((-13_i64).unbounded_shl(64), 0);"
"assert_eq!((-13_i64).unbounded_shl(1).unbounded_shl(63), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
if rhs < Self::BITS { unsafe { self.unchecked_shl(rhs) } } else { 0 }
"`i64::BITS`."
"assert_eq!(0x1i64.shl_exact(4), Some(0x10));"
"assert_eq!(0x1i64.shl_exact(i64::BITS - 2), Some(1 << i64::BITS - 2));"
"assert_eq!(0x1i64.shl_exact(i64::BITS - 1), None);"
"assert_eq!((-0x2i64).shl_exact(i64::BITS - 2), Some(-0x2 << i64::BITS - 2));"
"assert_eq!((-0x2i64).shl_exact(i64::BITS - 1), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<i64>
if rhs < self.leading_zeros() || rhs < self.leading_ones() {
    Some(unsafe { self.unchecked_shl(rhs) })
} else { None }
"`i64::BITS`."
"[`i64::shl_exact`]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(zeros: u32, ones: u32, rhs: u32) {
        if !(rhs < zeros || rhs < ones) {
            let msg =
                "unsafe precondition(s) violated: i64::unchecked_shl_exact cannot shift out bits that would change the value of the first bit\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_library_ub() {
        precondition_check(self.leading_zeros(), self.leading_ones(), rhs);
    }
};
unsafe { self.unchecked_shl(rhs) }
"assert_eq!(0x10i64.checked_shr(4), Some(0x1));"
"assert_eq!(0x10i64.checked_shr(128), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<Self>
if rhs < Self::BITS { Some(unsafe { self.unchecked_shr(rhs) }) } else { None }
"assert_eq!(0x10i64.strict_shr(4), 0x1);"
"let _ = 0x10i64.strict_shr(128);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
let (a, b) = self.overflowing_shr(rhs);
if b { imp::overflow_panic::shr() } else { a }
"[`checked_shr`]: i64::checked_shr"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(rhs: u32) {
        if !(rhs < <i64>::BITS) {
            let msg =
                "unsafe precondition(s) violated: i64::unchecked_shr cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(rhs); }
};
unsafe { intrinsics::unchecked_shr(self, rhs) }
"assert_eq!(0x10_i64.unbounded_shr(4), 0x1);"
"assert_eq!(0x10_i64.unbounded_shr(129), 0);"
"assert_eq!(i64::MIN.unbounded_shr(129), -1);"
"assert_eq!(0b1010_i64.unbounded_shr(0), 0b1010);"
"assert_eq!(0b1010_i64.unbounded_shr(1), 0b101);"
"assert_eq!(0b1010_i64.unbounded_shr(2), 0b10);"
"assert_eq!(42_i64.unbounded_shr(64), 0);"
"assert_eq!(42_i64.unbounded_shr(1).unbounded_shr(63), 0);"
"assert_eq!((-13_i64).unbounded_shr(64), -1);"
"assert_eq!((-13_i64).unbounded_shr(1).unbounded_shr(63), -1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
if rhs < Self::BITS {
    unsafe { self.unchecked_shr(rhs) }
} else { unsafe { self.unchecked_shr(Self::BITS - 1) } }
"`i64::BITS`."
"assert_eq!(0x10i64.shr_exact(4), Some(0x1));"
"assert_eq!(0x10i64.shr_exact(5), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<i64>
if rhs <= self.trailing_zeros() && rhs < <i64>::BITS {
    Some(unsafe { self.unchecked_shr(rhs) })
} else { None }
"`i64::BITS`."
"i64::BITS`"
"[`i64::shr_exact`]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(zeros: u32, bits: u32, rhs: u32) {
        if !(rhs <= zeros && rhs < bits) {
            let msg =
                "unsafe precondition(s) violated: i64::unchecked_shr_exact cannot shift out non-zero bits\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_library_ub() {
        precondition_check(self.trailing_zeros(), <i64>::BITS, rhs);
    }
};
unsafe { self.unchecked_shr(rhs) }
"assert_eq!((-5i64).checked_abs(), Some(5));"
"assert_eq!(i64::MIN.checked_abs(), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<Self>
if self.is_negative() { self.checked_neg() } else { Some(self) }
"assert_eq!((-5i64).strict_abs(), 5);"
"let _ = i64::MIN.strict_abs();"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
if self.is_negative() { self.strict_neg() } else { self }
"assert_eq!(8i64.checked_pow(2), Some(64));"
"assert_eq!(0_i64.checked_pow(0), Some(1));"
"assert_eq!(i64::MAX.checked_pow(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Option<Self>
if exp == 0 { return Some(1); }
let mut base = self;
let mut acc: Self = 1;
loop {
    if (exp & 1) == 1 {
        acc =
            match acc.checked_mul(base) {
                Some(x) => x,
                None => return None,
            };
        if exp == 1 { return Some(acc); }
    }
    exp /= 2;
    base =
        match base.checked_mul(base) { Some(x) => x, None => return None, };
}
"assert_eq!(8i64.strict_pow(2), 64);"
"assert_eq!(0_i64.strict_pow(0), 1);"
"let _ = i64::MAX.strict_pow(2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Self
if exp == 0 { return 1; }
let mut base = self;
let mut acc: Self = 1;
loop {
    if (exp & 1) == 1 {
        acc = acc.strict_mul(base);
        if exp == 1 { return acc; }
    }
    exp /= 2;
    base = base.strict_mul(base);
}
"assert_eq!(10i64.checked_isqrt(), Some(3));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<Self>
if self < 0 {
    None
} else {
    let result = unsafe { imp::int_sqrt::i64(self as i64) as i64 };
    unsafe {
        const MAX_RESULT: i64 =
            unsafe { imp::int_sqrt::i64(<i64>::MAX) as i64 };
        crate::hint::assert_unchecked(result >= 0);
        crate::hint::assert_unchecked(result <= MAX_RESULT);
    }
    Some(result)
}
"assert_eq!(100i64.saturating_add(1), 101);"
"assert_eq!(i64::MAX.saturating_add(100), i64::MAX);"
"assert_eq!(i64::MIN.saturating_add(-1), i64::MIN);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::saturating_add(self, rhs);
"assert_eq!(1i64.saturating_add_unsigned(2), 3);"
"assert_eq!(i64::MAX.saturating_add_unsigned(100), i64::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Self
match self.checked_add_unsigned(rhs) { Some(x) => x, None => Self::MAX, }
"assert_eq!(100i64.saturating_sub(127), -27);"
"assert_eq!(i64::MIN.saturating_sub(100), i64::MIN);"
"assert_eq!(i64::MAX.saturating_sub(-1), i64::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::saturating_sub(self, rhs);
"assert_eq!(100i64.saturating_sub_unsigned(127), -27);"
"assert_eq!(i64::MIN.saturating_sub_unsigned(100), i64::MIN);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Self
match self.checked_sub_unsigned(rhs) { Some(x) => x, None => Self::MIN, }
"assert_eq!(100i64.saturating_neg(), -100);"
"assert_eq!((-100i64).saturating_neg(), 100);"
"assert_eq!(i64::MIN.saturating_neg(), i64::MAX);"
"assert_eq!(i64::MAX.saturating_neg(), i64::MIN + 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
intrinsics::saturating_sub(0, self);
"assert_eq!(100i64.saturating_abs(), 100);"
"assert_eq!((-100i64).saturating_abs(), 100);"
"assert_eq!(i64::MIN.saturating_abs(), i64::MAX);"
"assert_eq!((i64::MIN + 1).saturating_abs(), i64::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
if self.is_negative() { self.saturating_neg() } else { self }
"assert_eq!(10i64.saturating_mul(12), 120);"
"assert_eq!(i64::MAX.saturating_mul(10), i64::MAX);"
"assert_eq!(i64::MIN.saturating_mul(10), i64::MIN);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
match self.checked_mul(rhs) {
    Some(x) => x,
    None => if (self < 0) == (rhs < 0) { Self::MAX } else { Self::MIN },
}
"assert_eq!(5i64.saturating_div(2), 2);"
"assert_eq!(i64::MAX.saturating_div(-1), i64::MIN + 1);"
"assert_eq!(i64::MIN.saturating_div(-1), i64::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
match self.overflowing_div(rhs) {
    (result, false) => result,
    (_result, true) => Self::MAX,
}
"assert_eq!((-4i64).saturating_pow(3), -64);"
"assert_eq!(0_i64.saturating_pow(0), 1);"
"assert_eq!(i64::MIN.saturating_pow(2), i64::MAX);"
"assert_eq!(i64::MIN.saturating_pow(3), i64::MIN);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
exp
Self
match self.checked_pow(exp) {
    Some(x) => x,
    None if self < 0 && exp % 2 == 1 => Self::MIN,
    None => Self::MAX,
}
"assert_eq!(100i64.wrapping_add(27), 127);"
"assert_eq!(i64::MAX.wrapping_add(2), i64::MIN + 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::wrapping_add(self, rhs);
"assert_eq!(100i64.wrapping_add_unsigned(27), 127);"
"assert_eq!(i64::MAX.wrapping_add_unsigned(2), i64::MIN + 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Self
self.wrapping_add(rhs as Self);
"assert_eq!(0i64.wrapping_sub(127), -127);"
"assert_eq!((-2i64).wrapping_sub(i64::MAX), i64::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::wrapping_sub(self, rhs);
"assert_eq!(0i64.wrapping_sub_unsigned(127), -127);"
"assert_eq!((-2i64).wrapping_sub_unsigned(u64::MAX), -1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Self
self.wrapping_sub(rhs as Self);
"assert_eq!(10i64.wrapping_mul(12), 120);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::wrapping_mul(self, rhs);
"assert_eq!(100i64.wrapping_div(10), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self.overflowing_div(rhs).0;
"assert_eq!(100i64.wrapping_div_euclid(10), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self.overflowing_div_euclid(rhs).0;
"assert_eq!(100i64.wrapping_rem(10), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self.overflowing_rem(rhs).0;
"assert_eq!(100i64.wrapping_rem_euclid(10), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self.overflowing_rem_euclid(rhs).0;
"assert_eq!(100i64.wrapping_neg(), -100);"
"assert_eq!((-100i64).wrapping_neg(), 100);"
"assert_eq!(i64::MIN.wrapping_neg(), i64::MIN);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
(0 as i64).wrapping_sub(self);
"assert_eq!((-1_i64).wrapping_shl(7), -128);"
"assert_eq!(42_i64.wrapping_shl(64), 42);"
"assert_eq!(42_i64.wrapping_shl(1).wrapping_shl(63), 0);"
"assert_eq!((-1_i64).wrapping_shl(128), -1);"
"assert_eq!(5_i64.wrapping_shl(1025), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
unsafe { self.unchecked_shl(rhs & (Self::BITS - 1)) }
"assert_eq!((-128_i64).wrapping_shr(7), -1);"
"assert_eq!(42_i64.wrapping_shr(64), 42);"
"assert_eq!(42_i64.wrapping_shr(1).wrapping_shr(63), 0);"
"assert_eq!(10_i64.wrapping_shr(1025), 5);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
unsafe { self.unchecked_shr(rhs & (Self::BITS - 1)) }
"assert_eq!(100i64.wrapping_abs(), 100);"
"assert_eq!((-100i64).wrapping_abs(), 100);"
"assert_eq!(i64::MIN.wrapping_abs(), i64::MIN);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
if self.is_negative() { self.wrapping_neg() } else { self }
"assert_eq!(100i64.unsigned_abs(), 100u64);"
"assert_eq!((-100i64).unsigned_abs(), 100u64);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
self.wrapping_abs() as u64;
"assert_eq!(3i64.wrapping_pow(4), 81);"
"assert_eq!(0_i64.wrapping_pow(0), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Self
if exp == 0 { return 1; }
let mut base = self;
let mut acc: Self = 1;
if intrinsics::is_val_statically_known(exp) {
    while exp > 1 {
        if (exp & 1) == 1 { acc = acc.wrapping_mul(base); }
        exp /= 2;
        base = base.wrapping_mul(base);
    }
    acc.wrapping_mul(base)
} else {
    loop {
        if (exp & 1) == 1 {
            acc = acc.wrapping_mul(base);
            if exp == 1 { return acc; }
        }
        exp /= 2;
        base = base.wrapping_mul(base);
    }
}
"assert_eq!(5i64.overflowing_add(2), (7, false));"
"assert_eq!(i64::MAX.overflowing_add(1), (i64::MIN, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
let (a, b) = intrinsics::add_with_overflow(self as i64, rhs as i64);
(a as Self, b);
"[`u64::carrying_add`]"
"//   10  MAX    (a = 10 \u{d7} 2^64 + 2^64 - 1)"
"// + -5    9    (b = -5 \u{d7} 2^64 + 9)"
"//    6    8    (sum = 6 \u{d7} 2^64 + 8)"
"let (a1, a0): (i64, u64) = (10, u64::MAX);"
"let (b1, b0): (i64, u64) = (-5, 9);"
"// u64::carrying_add for the less significant words"
"// i64::carrying_add for the most significant word"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
bool
carry
(Self, bool)
let (a, b) = self.overflowing_add(rhs);
let (c, d) = a.overflowing_add(carry as i64);
(c, b != d);
"assert_eq!(1i64.overflowing_add_unsigned(2), (3, false));"
"assert_eq!((i64::MIN).overflowing_add_unsigned(u64::MAX), (i64::MAX, false));"
"assert_eq!((i64::MAX - 2).overflowing_add_unsigned(3), (i64::MIN, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
(Self, bool)
let rhs = rhs as Self;
let (res, overflowed) = self.overflowing_add(rhs);
(res, overflowed ^ (rhs < 0));
"assert_eq!(5i64.overflowing_sub(2), (3, false));"
"assert_eq!(i64::MIN.overflowing_sub(1), (i64::MAX, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
let (a, b) = intrinsics::sub_with_overflow(self as i64, rhs as i64);
(a as Self, b);
"[`u64::borrowing_sub`]"
"//    6    8    (a = 6 \u{d7} 2^64 + 8)"
"// - -5    9    (b = -5 \u{d7} 2^64 + 9)"
"//   10  MAX    (diff = 10 \u{d7} 2^64 + 2^64 - 1)"
"let (a1, a0): (i64, u64) = (6, 8);"
"let (b1, b0): (i64, u64) = (-5, 9);"
"// u64::borrowing_sub for the less significant words"
"// i64::borrowing_sub for the most significant word"
"assert_eq!((diff1, diff0), (10, u64::MAX));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
bool
borrow
(Self, bool)
let (a, b) = self.overflowing_sub(rhs);
let (c, d) = a.overflowing_sub(borrow as i64);
(c, b != d);
"assert_eq!(1i64.overflowing_sub_unsigned(2), (-1, false));"
"assert_eq!((i64::MAX).overflowing_sub_unsigned(u64::MAX), (i64::MIN, false));"
"assert_eq!((i64::MIN + 2).overflowing_sub_unsigned(3), (i64::MAX, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
(Self, bool)
let rhs = rhs as Self;
let (res, overflowed) = self.overflowing_sub(rhs);
(res, overflowed ^ (rhs < 0));
"assert_eq!(5i64.overflowing_mul(2), (10, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
let (a, b) = intrinsics::mul_with_overflow(self as i64, rhs as i64);
(a as Self, b);
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(u64, Self)
Self::carrying_mul_add(self, rhs, 0, 0);
"assert_eq!(i64::MAX.carrying_mul(i64::MAX, i64::MAX), (i64::MAX.unsigned_abs() + 1, i64::MAX / 2));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
carry
(u64, Self)
Self::carrying_mul_add(self, rhs, carry, 0);
"assert_eq!(i64::MAX.carrying_mul_add(i64::MAX, i64::MAX, i64::MAX), (u64::MAX, i64::MAX / 2));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
carry
Self
add
(u64, Self)
intrinsics::carrying_mul_add(self, rhs, carry, add);
"assert_eq!(5i64.overflowing_div(2), (2, false));"
"assert_eq!(i64::MIN.overflowing_div(-1), (i64::MIN, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
if intrinsics::unlikely((self == Self::MIN) & (rhs == -1)) {
    (self, true)
} else { (self / rhs, false) }
"assert_eq!(5i64.overflowing_div_euclid(2), (2, false));"
"assert_eq!(i64::MIN.overflowing_div_euclid(-1), (i64::MIN, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
if intrinsics::unlikely((self == Self::MIN) & (rhs == -1)) {
    (self, true)
} else { (self.div_euclid(rhs), false) }
"assert_eq!(5i64.overflowing_rem(2), (1, false));"
"assert_eq!(i64::MIN.overflowing_rem(-1), (0, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
if intrinsics::unlikely(rhs == -1) {
    (0, self == Self::MIN)
} else { (self % rhs, false) }
"assert_eq!(5i64.overflowing_rem_euclid(2), (1, false));"
"assert_eq!(i64::MIN.overflowing_rem_euclid(-1), (0, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
if intrinsics::unlikely(rhs == -1) {
    (0, self == Self::MIN)
} else { (self.rem_euclid(rhs), false) }
"assert_eq!(2i64.overflowing_neg(), (-2, false));"
"assert_eq!(i64::MIN.overflowing_neg(), (i64::MIN, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
(Self, bool)
if intrinsics::unlikely(self == Self::MIN) {
    (Self::MIN, true)
} else { (-self, false) }
"assert_eq!(0x1i64.overflowing_shl(4), (0x10, false));"
"assert_eq!(0x10i64.overflowing_shl(63), (0, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
(Self, bool)
(self.wrapping_shl(rhs), rhs >= Self::BITS);
"assert_eq!(0x10i64.overflowing_shr(4), (0x1, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
(Self, bool)
(self.wrapping_shr(rhs), rhs >= Self::BITS);
"(e.g., i64::MIN for values of type i64),"
"assert_eq!(10i64.overflowing_abs(), (10, false));"
"assert_eq!((-10i64).overflowing_abs(), (10, false));"
"assert_eq!((i64::MIN).overflowing_abs(), (i64::MIN, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
(Self, bool)
(self.wrapping_abs(), self == Self::MIN);
"assert_eq!(3i64.overflowing_pow(4), (81, false));"
"assert_eq!(0_i64.overflowing_pow(0), (1, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
(Self, bool)
if exp == 0 { return (1, false); }
let mut base = self;
let mut acc: Self = 1;
let mut overflown = false;
let mut r;
loop {
    if (exp & 1) == 1 {
        r = acc.overflowing_mul(base);
        if exp == 1 { r.1 |= overflown; return r; }
        acc = r.0;
        overflown |= r.1;
    }
    exp /= 2;
    r = base.overflowing_mul(base);
    base = r.0;
    overflown |= r.1;
}
"let x: i64 = 2; // or any other integer type"
"assert_eq!(0_i64.pow(0), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Self
if exp == 0 { return 1; }
let mut base = self;
let mut acc = 1;
if intrinsics::is_val_statically_known(exp) {
    while exp > 1 {
        if (exp & 1) == 1 { acc = acc * base; }
        exp /= 2;
        base = base * base;
    }
    acc * base
} else {
    loop {
        if (exp & 1) == 1 { acc = acc * base; if exp == 1 { return acc; } }
        exp /= 2;
        base = base * base;
    }
}
"assert_eq!(10i64.isqrt(), 3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
match self.checked_isqrt() {
    Some(sqrt) => sqrt,
    None => imp::int_sqrt::panic_for_negative_argument(),
}
"let a: i64 = 7; // or any other integer type"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let q = self / rhs;
if self % rhs < 0 { return if rhs > 0 { q - 1 } else { q + 1 } }
q;
"let a: i64 = 7; // or any other integer type"
"let _ = i64::MIN.rem_euclid(-1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let r = self % rhs;
if r < 0 { r.wrapping_add(rhs.wrapping_abs()) } else { r }
"let a: i64 = 8;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let d = self / rhs;
let r = self % rhs;
let correction = (self ^ rhs) >> (Self::BITS - 1);
if r != 0 { d + correction } else { d }
"let a: i64 = 8;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let d = self / rhs;
let r = self % rhs;
let correction = 1 + ((self ^ rhs) >> (Self::BITS - 1));
if r != 0 { d + correction } else { d }
"assert_eq!(16_i64.next_multiple_of(8), 16);"
"assert_eq!(23_i64.next_multiple_of(8), 24);"
"assert_eq!(16_i64.next_multiple_of(-8), 16);"
"assert_eq!(23_i64.next_multiple_of(-8), 16);"
"assert_eq!((-16_i64).next_multiple_of(8), -16);"
"assert_eq!((-23_i64).next_multiple_of(8), -16);"
"assert_eq!((-16_i64).next_multiple_of(-8), -16);"
"assert_eq!((-23_i64).next_multiple_of(-8), -24);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
if rhs == -1 { return self; }
let r = self % rhs;
let m = if (r > 0 && rhs < 0) || (r < 0 && rhs > 0) { r + rhs } else { r };
if m == 0 { self } else { self + (rhs - m) }
"assert_eq!(16_i64.checked_next_multiple_of(8), Some(16));"
"assert_eq!(23_i64.checked_next_multiple_of(8), Some(24));"
"assert_eq!(16_i64.checked_next_multiple_of(-8), Some(16));"
"assert_eq!(23_i64.checked_next_multiple_of(-8), Some(16));"
"assert_eq!((-16_i64).checked_next_multiple_of(8), Some(-16));"
"assert_eq!((-23_i64).checked_next_multiple_of(8), Some(-16));"
"assert_eq!((-16_i64).checked_next_multiple_of(-8), Some(-16));"
"assert_eq!((-23_i64).checked_next_multiple_of(-8), Some(-24));"
"assert_eq!(1_i64.checked_next_multiple_of(0), None);"
"assert_eq!(i64::MAX.checked_next_multiple_of(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if rhs == -1 { return Some(self); }
let r = match self.checked_rem(rhs) { Some(x) => x, None => return None, };
let m = if (r > 0 && rhs < 0) || (r < 0 && rhs > 0) { r + rhs } else { r };
if m == 0 { Some(self) } else { self.checked_add(rhs - m) }
"assert_eq!(5i64.ilog(5), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
base
u32
if !(base >= 2) {
    {
        crate::panicking::panic_fmt(format_args!("base of integer logarithm must be at least 2"));
    }
};
if let Some(log) = self.checked_ilog(base) {
    log
} else { imp::int_log10::panic_for_nonpositive_argument() }
"assert_eq!(2i64.ilog2(), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
if let Some(log) = self.checked_ilog2() {
    log
} else { imp::int_log10::panic_for_nonpositive_argument() }
"assert_eq!(10i64.ilog10(), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
if let Some(log) = self.checked_ilog10() {
    log
} else { imp::int_log10::panic_for_nonpositive_argument() }
"assert_eq!(5i64.checked_ilog(5), Some(1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
base
Option<u32>
if self <= 0 || base <= 1 {
    None
} else { (self as u64).checked_ilog(base as u64) }
"assert_eq!(2i64.checked_ilog2(), Some(1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
if self <= 0 {
    None
} else {
    let log =
        (Self::BITS - 1) - unsafe { intrinsics::ctlz_nonzero(self) as u32 };
    Some(log)
}
"assert_eq!(10i64.checked_ilog10(), Some(1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
imp::int_log10::i64(self as i64);
"`i64::MIN`"
"`i64`,"
"`i64::MIN`"
"assert_eq!(10i64.abs(), 10);"
"assert_eq!((-10i64).abs(), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
if self.is_negative() { -self } else { self }
"assert_eq!(100i64.abs_diff(80), 20u64);"
"assert_eq!(100i64.abs_diff(110), 10u64);"
"assert_eq!((-100i64).abs_diff(80), 180u64);"
"assert_eq!((-100i64).abs_diff(-120), 20u64);"
"assert_eq!(i64::MIN.abs_diff(i64::MAX), u64::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
other
if self < other {
    (other as u64).wrapping_sub(self as u64)
} else { (self as u64).wrapping_sub(other as u64) }
"assert_eq!(10i64.signum(), 1);"
"assert_eq!(0i64.signum(), 0);"
"assert_eq!((-10i64).signum(), -1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
crate::intrinsics::three_way_compare(self, 0) as Self;
"assert!(10i64.is_positive());"
"assert!(!(-10i64).is_positive());"
Self
self
bool
self > 0;
"assert!((-10i64).is_negative());"
"assert!(!10i64.is_negative());"
Self
self
bool
self < 0;
"let bytes = 0x1234567890123456i64.to_be_bytes();"
"assert_eq!(bytes, [0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
self.to_be().to_ne_bytes();
"let bytes = 0x1234567890123456i64.to_le_bytes();"
"assert_eq!(bytes, [0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
self.to_le().to_ne_bytes();
"let bytes = 0x1234567890123456i64.to_ne_bytes();"
"        [0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]"
"        [0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
unsafe { mem::transmute(self) }
"let value = i64::from_be_bytes([0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]);"
"assert_eq!(value, 0x1234567890123456);"
"fn read_be_i64(input: &mut &[u8]) -> i64 {"
"    let (int_bytes, rest) = input.split_at(size_of::<i64>());"
"    i64::from_be_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
Self::from_be(Self::from_ne_bytes(bytes));
"let value = i64::from_le_bytes([0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]);"
"assert_eq!(value, 0x1234567890123456);"
"fn read_le_i64(input: &mut &[u8]) -> i64 {"
"    let (int_bytes, rest) = input.split_at(size_of::<i64>());"
"    i64::from_le_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
Self::from_le(Self::from_ne_bytes(bytes));
"let value = i64::from_ne_bytes(if cfg!(target_endian = \"big\") {"
"    [0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]"
"    [0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]"
"assert_eq!(value, 0x1234567890123456);"
"fn read_ne_i64(input: &mut &[u8]) -> i64 {"
"    let (int_bytes, rest) = input.split_at(size_of::<i64>());"
"    i64::from_ne_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
unsafe { mem::transmute(bytes) }
"[`i64::MIN`] instead."
"i64_legacy_fn_min_value"
Self
Self::MIN;
"[`i64::MAX`] instead."
"i64_legacy_fn_max_value"
Self
Self::MAX;
"assert_eq!(120i64.clamp_magnitude(100), 100);"
"assert_eq!(-120i64.clamp_magnitude(100), -100);"
"assert_eq!(80i64.clamp_magnitude(100), 80);"
"assert_eq!(-80i64.clamp_magnitude(100), -80);"
"this returns the clamped value and does not modify the original"
Self
self
limit
Self
if let Ok(limit) = core::convert::TryInto::<i64>::try_into(limit) {
    self.clamp(-limit, limit)
} else { self }
"assert_eq!(120i8, 120i64.truncate());"
"assert_eq!(-120i8, (-120i64).truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Target
traits::TruncateTarget::internal_truncate(self);
"assert_eq!(120i8, 120i64.saturating_truncate());"
"assert_eq!(-120i8, (-120i64).saturating_truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Target
traits::TruncateTarget::internal_saturating_truncate(self);
"assert_eq!(Some(120i8), 120i64.checked_truncate());"
"assert_eq!(Some(-120i8), (-120i64).checked_truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Option<Target>
traits::TruncateTarget::internal_checked_truncate(self);
"assert_eq!(120i128, 120i8.extend());"
"assert_eq!(-120i128, (-120i8).extend());"
"this returns the extended value and does not modify the original"
Self
Target
Self
self
Target
traits::ExtendTarget::internal_extend(self);int_impl! {
415        Self = i64,
416        ActualT = i64,
417        UnsignedT = u64,
418        BITS = 64,
419        BITS_MINUS_ONE = 63,
420        Min = -9223372036854775808,
421        Max = 9223372036854775807,
422        rot = 12,
423        rot_op = "0xaa00000000006e1",
424        rot_result = "0x6e10aa",
425        swap_op = "0x1234567890123456",
426        swapped = "0x5634129078563412",
427        reversed = "0x6a2c48091e6a2c48",
428        le_bytes = "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
429        be_bytes = "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]",
430        to_xe_bytes_doc = "",
431        from_xe_bytes_doc = "",
432        bound_condition = "",
433    }
434    "assert_eq!(0i64.midpoint(4), 2);"
"assert_eq!((-1i64).midpoint(2), 0);"
"assert_eq!((-7i64).midpoint(0), -3);"
"assert_eq!(0i64.midpoint(-7), -3);"
"assert_eq!(0i64.midpoint(7), 3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let t = ((self ^ rhs) >> 1) + (self & rhs);
t + (if t < 0 { 1 } else { 0 } & (self ^ rhs));midpoint_impl! { i64, signed }
435}
436
437impl i128 {
438    "(&minus;2<sup>127</sup>)."
"assert_eq!(i128::MIN, -170141183460469231731687303715884105728);"
Self
!Self::MAX
"(2<sup>127</sup> &minus; 1)."
"assert_eq!(i128::MAX, 170141183460469231731687303715884105727);"
Self
(<u128>::MAX >> 1) as Self
"assert_eq!(i128::BITS, 128);"
u32
<u128>::BITS
"let n = 0b100_0000i128;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(self as u128).count_ones();
"assert_eq!(i128::MAX.count_zeros(), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(!self).count_ones();
"let n = -1i128;"
"[`ilog2`]: i128::ilog2"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(self as u128).leading_zeros();
"let n = -4i128;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(self as u128).trailing_zeros();
"let n = -1i128;"
"assert_eq!(n.leading_ones(), 128);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(self as u128).leading_ones();
"let n = 3i128;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(self as u128).trailing_ones();
"let n: i128 = 0b_01100100;"
"assert_eq!(0_i128.isolate_highest_one(), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
self &
    (((1 as i128) << (<i128>::BITS - 1)).wrapping_shr(self.leading_zeros()));
"let n: i128 = 0b_01100100;"
"assert_eq!(0_i128.isolate_lowest_one(), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
self & self.wrapping_neg();
"assert_eq!(0b0_i128.highest_one(), None);"
"assert_eq!(0b1_i128.highest_one(), Some(0));"
"assert_eq!(0b1_0000_i128.highest_one(), Some(4));"
"assert_eq!(0b1_1111_i128.highest_one(), Some(4));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
(self as u128).highest_one();
"assert_eq!(0b0_i128.lowest_one(), None);"
"assert_eq!(0b1_i128.lowest_one(), Some(0));"
"assert_eq!(0b1_0000_i128.lowest_one(), Some(4));"
"assert_eq!(0b1_1111_i128.lowest_one(), Some(0));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
(self as u128).lowest_one();
"let n = -1i128;"
"assert_eq!(n.cast_unsigned(), u128::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
self as u128;
"let n = 0x13f40000000000000000000000004f76i128;"
"let m = 0x4f7613f4;"
"assert_eq!(n.rotate_left(16), m);"
"assert_eq!(n.rotate_left(1024), n);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
n
Self
(self as u128).rotate_left(n) as Self;
"let n = 0x4f7613f4i128;"
"let m = 0x13f40000000000000000000000004f76;"
"assert_eq!(n.rotate_right(16), m);"
"assert_eq!(n.rotate_right(1024), n);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
n
Self
(self as u128).rotate_right(n) as Self;
"let n = 0x12345678901234567890123456789012i128;"
"assert_eq!(m, 0x12907856341290785634129078563412);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
(self as u128).swap_bytes() as Self;
"let n = 0x12345678901234567890123456789012i128;"
"assert_eq!(m, 0x48091e6a2c48091e6a2c48091e6a2c48);"
"assert_eq!(0, 0i128.reverse_bits());"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
(self as u128).reverse_bits() as Self;
"let n = 0x1Ai128;"
"    assert_eq!(i128::from_be(n), n)"
"    assert_eq!(i128::from_be(n), n.swap_bytes())"
Self
x
Self
{ x.swap_bytes() }
"let n = 0x1Ai128;"
"    assert_eq!(i128::from_le(n), n)"
"    assert_eq!(i128::from_le(n), n.swap_bytes())"
Self
x
Self
{ x }
"`i128`."
"let n = 0x1Ai128;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
{ self.swap_bytes() }
"`i128`."
"let n = 0x1Ai128;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
{ self }
"assert_eq!((i128::MAX - 2).checked_add(1), Some(i128::MAX - 1));"
"assert_eq!((i128::MAX - 2).checked_add(3), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
let (a, b) = self.overflowing_add(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!((i128::MAX - 2).strict_add(1), i128::MAX - 1);"
"let _ = (i128::MAX - 2).strict_add(3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_add(rhs);
if b { imp::overflow_panic::add() } else { a }
"`self + rhs > i128::MAX` or `self + rhs < i128::MIN`,"
"[`checked_add`]: i128::checked_add"
"[`wrapping_add`]: i128::wrapping_add"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: i128, rhs: i128) {
        if !!lhs.overflowing_add(rhs).1 {
            let msg =
                "unsafe precondition(s) violated: i128::unchecked_add cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::unchecked_add(self, rhs) }
"assert_eq!(1i128.checked_add_unsigned(2), Some(3));"
"assert_eq!((i128::MAX - 2).checked_add_unsigned(3), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Option<Self>
let (a, b) = self.overflowing_add_unsigned(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!(1i128.strict_add_unsigned(2), 3);"
"let _ = (i128::MAX - 2).strict_add_unsigned(3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Self
let (a, b) = self.overflowing_add_unsigned(rhs);
if b { imp::overflow_panic::add() } else { a }
"assert_eq!((i128::MIN + 2).checked_sub(1), Some(i128::MIN + 1));"
"assert_eq!((i128::MIN + 2).checked_sub(3), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
let (a, b) = self.overflowing_sub(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!((i128::MIN + 2).strict_sub(1), i128::MIN + 1);"
"let _ = (i128::MIN + 2).strict_sub(3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_sub(rhs);
if b { imp::overflow_panic::sub() } else { a }
"`self - rhs > i128::MAX` or `self - rhs < i128::MIN`,"
"[`checked_sub`]: i128::checked_sub"
"[`wrapping_sub`]: i128::wrapping_sub"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: i128, rhs: i128) {
        if !!lhs.overflowing_sub(rhs).1 {
            let msg =
                "unsafe precondition(s) violated: i128::unchecked_sub cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::unchecked_sub(self, rhs) }
"assert_eq!(1i128.checked_sub_unsigned(2), Some(-1));"
"assert_eq!((i128::MIN + 2).checked_sub_unsigned(3), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Option<Self>
let (a, b) = self.overflowing_sub_unsigned(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!(1i128.strict_sub_unsigned(2), -1);"
"let _ = (i128::MIN + 2).strict_sub_unsigned(3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Self
let (a, b) = self.overflowing_sub_unsigned(rhs);
if b { imp::overflow_panic::sub() } else { a }
"assert_eq!(i128::MAX.checked_mul(1), Some(i128::MAX));"
"assert_eq!(i128::MAX.checked_mul(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
let (a, b) = self.overflowing_mul(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!(i128::MAX.strict_mul(1), i128::MAX);"
"let _ = i128::MAX.strict_mul(2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_mul(rhs);
if b { imp::overflow_panic::mul() } else { a }
"`self * rhs > i128::MAX` or `self * rhs < i128::MIN`,"
"[`checked_mul`]: i128::checked_mul"
"[`wrapping_mul`]: i128::wrapping_mul"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: i128, rhs: i128) {
        if !!lhs.overflowing_mul(rhs).1 {
            let msg =
                "unsafe precondition(s) violated: i128::unchecked_mul cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::unchecked_mul(self, rhs) }
"assert_eq!((i128::MIN + 1).checked_div(-1), Some(170141183460469231731687303715884105727));"
"assert_eq!(i128::MIN.checked_div(-1), None);"
"assert_eq!((1i128).checked_div(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0 || ((self == Self::MIN) && (rhs == -1))) {
    None
} else { Some(unsafe { intrinsics::unchecked_div(self, rhs) }) }
"assert_eq!((i128::MIN + 1).strict_div(-1), 170141183460469231731687303715884105727);"
"let _ = i128::MIN.strict_div(-1);"
"let _ = (1i128).strict_div(0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_div(rhs);
if b { imp::overflow_panic::div() } else { a }
"assert_eq!((i128::MIN + 1).checked_div_euclid(-1), Some(170141183460469231731687303715884105727));"
"assert_eq!(i128::MIN.checked_div_euclid(-1), None);"
"assert_eq!((1i128).checked_div_euclid(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0 || ((self == Self::MIN) & (rhs == -1))) {
    None
} else { Some(self.div_euclid(rhs)) }
"assert_eq!((i128::MIN + 1).strict_div_euclid(-1), 170141183460469231731687303715884105727);"
"let _ = i128::MIN.strict_div_euclid(-1);"
"let _ = (1i128).strict_div_euclid(0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_div_euclid(rhs);
if b { imp::overflow_panic::div() } else { a }
"assert_eq!((i128::MIN + 1).checked_div_exact(-1), Some(170141183460469231731687303715884105727));"
"assert_eq!((-5i128).checked_div_exact(2), None);"
"assert_eq!(i128::MIN.checked_div_exact(-1), None);"
"assert_eq!((1i128).checked_div_exact(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0 || ((self == Self::MIN) && (rhs == -1))) {
    None
} else {
    unsafe {
        if intrinsics::unlikely(intrinsics::unchecked_rem(self, rhs) != 0) {
            None
        } else { Some(intrinsics::exact_div(self, rhs)) }
    }
}
"assert_eq!(64i128.div_exact(2), Some(32));"
"assert_eq!(64i128.div_exact(32), Some(2));"
"assert_eq!((i128::MIN + 1).div_exact(-1), Some(170141183460469231731687303715884105727));"
"assert_eq!(65i128.div_exact(2), None);"
"let _ = 64i128.div_exact(0);"
"let _ = i128::MIN.div_exact(-1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if self % rhs != 0 { None } else { Some(self / rhs) }
"`self == i128::MIN && rhs == -1`,"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: i128, rhs: i128) {
        if !(rhs > 0 && lhs % rhs == 0 && (lhs != <i128>::MIN || rhs != -1)) {
            let msg =
                "unsafe precondition(s) violated: i128::unchecked_div_exact cannot overflow, divide by zero, or leave a remainder\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::exact_div(self, rhs) }
"assert_eq!(5i128.checked_rem(2), Some(1));"
"assert_eq!(5i128.checked_rem(0), None);"
"assert_eq!(i128::MIN.checked_rem(-1), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0 || ((self == Self::MIN) && (rhs == -1))) {
    None
} else { Some(unsafe { intrinsics::unchecked_rem(self, rhs) }) }
"assert_eq!(5i128.strict_rem(2), 1);"
"let _ = 5i128.strict_rem(0);"
"let _ = i128::MIN.strict_rem(-1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_rem(rhs);
if b { imp::overflow_panic::rem() } else { a }
"assert_eq!(5i128.checked_rem_euclid(2), Some(1));"
"assert_eq!(5i128.checked_rem_euclid(0), None);"
"assert_eq!(i128::MIN.checked_rem_euclid(-1), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0 || ((self == Self::MIN) & (rhs == -1))) {
    None
} else { Some(self.rem_euclid(rhs)) }
"assert_eq!(5i128.strict_rem_euclid(2), 1);"
"let _ = 5i128.strict_rem_euclid(0);"
"let _ = i128::MIN.strict_rem_euclid(-1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_rem_euclid(rhs);
if b { imp::overflow_panic::rem() } else { a }
"assert_eq!(5i128.checked_neg(), Some(-5));"
"assert_eq!(i128::MIN.checked_neg(), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<Self>
let (a, b) = self.overflowing_neg();
if intrinsics::unlikely(b) { None } else { Some(a) }
"`self == i128::MIN`,"
"[`checked_neg`]: i128::checked_neg"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: i128) {
        if !!lhs.overflowing_neg().1 {
            let msg =
                "unsafe precondition(s) violated: i128::unchecked_neg cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(self); }
};
unsafe { intrinsics::unchecked_sub(0, self) }
"assert_eq!(5i128.strict_neg(), -5);"
"let _ = i128::MIN.strict_neg();"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
let (a, b) = self.overflowing_neg();
if b { imp::overflow_panic::neg() } else { a }
"assert_eq!(0x1i128.checked_shl(4), Some(0x10));"
"assert_eq!(0x1i128.checked_shl(129), None);"
"assert_eq!(0x10i128.checked_shl(127), Some(0));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<Self>
if rhs < Self::BITS { Some(unsafe { self.unchecked_shl(rhs) }) } else { None }
"assert_eq!(0x1i128.strict_shl(4), 0x10);"
"let _ = 0x1i128.strict_shl(129);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
let (a, b) = self.overflowing_shl(rhs);
if b { imp::overflow_panic::shl() } else { a }
"[`checked_shl`]: i128::checked_shl"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(rhs: u32) {
        if !(rhs < <i128>::BITS) {
            let msg =
                "unsafe precondition(s) violated: i128::unchecked_shl cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(rhs); }
};
unsafe { intrinsics::unchecked_shl(self, rhs) }
"assert_eq!(0x1_i128.unbounded_shl(4), 0x10);"
"assert_eq!(0x1_i128.unbounded_shl(129), 0);"
"assert_eq!(0b101_i128.unbounded_shl(0), 0b101);"
"assert_eq!(0b101_i128.unbounded_shl(1), 0b1010);"
"assert_eq!(0b101_i128.unbounded_shl(2), 0b10100);"
"assert_eq!(42_i128.unbounded_shl(128), 0);"
"assert_eq!(42_i128.unbounded_shl(1).unbounded_shl(127), 0);"
"assert_eq!((-13_i128).unbounded_shl(128), 0);"
"assert_eq!((-13_i128).unbounded_shl(1).unbounded_shl(127), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
if rhs < Self::BITS { unsafe { self.unchecked_shl(rhs) } } else { 0 }
"`i128::BITS`."
"assert_eq!(0x1i128.shl_exact(4), Some(0x10));"
"assert_eq!(0x1i128.shl_exact(i128::BITS - 2), Some(1 << i128::BITS - 2));"
"assert_eq!(0x1i128.shl_exact(i128::BITS - 1), None);"
"assert_eq!((-0x2i128).shl_exact(i128::BITS - 2), Some(-0x2 << i128::BITS - 2));"
"assert_eq!((-0x2i128).shl_exact(i128::BITS - 1), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<i128>
if rhs < self.leading_zeros() || rhs < self.leading_ones() {
    Some(unsafe { self.unchecked_shl(rhs) })
} else { None }
"`i128::BITS`."
"[`i128::shl_exact`]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(zeros: u32, ones: u32, rhs: u32) {
        if !(rhs < zeros || rhs < ones) {
            let msg =
                "unsafe precondition(s) violated: i128::unchecked_shl_exact cannot shift out bits that would change the value of the first bit\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_library_ub() {
        precondition_check(self.leading_zeros(), self.leading_ones(), rhs);
    }
};
unsafe { self.unchecked_shl(rhs) }
"assert_eq!(0x10i128.checked_shr(4), Some(0x1));"
"assert_eq!(0x10i128.checked_shr(128), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<Self>
if rhs < Self::BITS { Some(unsafe { self.unchecked_shr(rhs) }) } else { None }
"assert_eq!(0x10i128.strict_shr(4), 0x1);"
"let _ = 0x10i128.strict_shr(128);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
let (a, b) = self.overflowing_shr(rhs);
if b { imp::overflow_panic::shr() } else { a }
"[`checked_shr`]: i128::checked_shr"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(rhs: u32) {
        if !(rhs < <i128>::BITS) {
            let msg =
                "unsafe precondition(s) violated: i128::unchecked_shr cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(rhs); }
};
unsafe { intrinsics::unchecked_shr(self, rhs) }
"assert_eq!(0x10_i128.unbounded_shr(4), 0x1);"
"assert_eq!(0x10_i128.unbounded_shr(129), 0);"
"assert_eq!(i128::MIN.unbounded_shr(129), -1);"
"assert_eq!(0b1010_i128.unbounded_shr(0), 0b1010);"
"assert_eq!(0b1010_i128.unbounded_shr(1), 0b101);"
"assert_eq!(0b1010_i128.unbounded_shr(2), 0b10);"
"assert_eq!(42_i128.unbounded_shr(128), 0);"
"assert_eq!(42_i128.unbounded_shr(1).unbounded_shr(127), 0);"
"assert_eq!((-13_i128).unbounded_shr(128), -1);"
"assert_eq!((-13_i128).unbounded_shr(1).unbounded_shr(127), -1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
if rhs < Self::BITS {
    unsafe { self.unchecked_shr(rhs) }
} else { unsafe { self.unchecked_shr(Self::BITS - 1) } }
"`i128::BITS`."
"assert_eq!(0x10i128.shr_exact(4), Some(0x1));"
"assert_eq!(0x10i128.shr_exact(5), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<i128>
if rhs <= self.trailing_zeros() && rhs < <i128>::BITS {
    Some(unsafe { self.unchecked_shr(rhs) })
} else { None }
"`i128::BITS`."
"i128::BITS`"
"[`i128::shr_exact`]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(zeros: u32, bits: u32, rhs: u32) {
        if !(rhs <= zeros && rhs < bits) {
            let msg =
                "unsafe precondition(s) violated: i128::unchecked_shr_exact cannot shift out non-zero bits\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_library_ub() {
        precondition_check(self.trailing_zeros(), <i128>::BITS, rhs);
    }
};
unsafe { self.unchecked_shr(rhs) }
"assert_eq!((-5i128).checked_abs(), Some(5));"
"assert_eq!(i128::MIN.checked_abs(), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<Self>
if self.is_negative() { self.checked_neg() } else { Some(self) }
"assert_eq!((-5i128).strict_abs(), 5);"
"let _ = i128::MIN.strict_abs();"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
if self.is_negative() { self.strict_neg() } else { self }
"assert_eq!(8i128.checked_pow(2), Some(64));"
"assert_eq!(0_i128.checked_pow(0), Some(1));"
"assert_eq!(i128::MAX.checked_pow(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Option<Self>
if exp == 0 { return Some(1); }
let mut base = self;
let mut acc: Self = 1;
loop {
    if (exp & 1) == 1 {
        acc =
            match acc.checked_mul(base) {
                Some(x) => x,
                None => return None,
            };
        if exp == 1 { return Some(acc); }
    }
    exp /= 2;
    base =
        match base.checked_mul(base) { Some(x) => x, None => return None, };
}
"assert_eq!(8i128.strict_pow(2), 64);"
"assert_eq!(0_i128.strict_pow(0), 1);"
"let _ = i128::MAX.strict_pow(2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Self
if exp == 0 { return 1; }
let mut base = self;
let mut acc: Self = 1;
loop {
    if (exp & 1) == 1 {
        acc = acc.strict_mul(base);
        if exp == 1 { return acc; }
    }
    exp /= 2;
    base = base.strict_mul(base);
}
"assert_eq!(10i128.checked_isqrt(), Some(3));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<Self>
if self < 0 {
    None
} else {
    let result = unsafe { imp::int_sqrt::i128(self as i128) as i128 };
    unsafe {
        const MAX_RESULT: i128 =
            unsafe { imp::int_sqrt::i128(<i128>::MAX) as i128 };
        crate::hint::assert_unchecked(result >= 0);
        crate::hint::assert_unchecked(result <= MAX_RESULT);
    }
    Some(result)
}
"assert_eq!(100i128.saturating_add(1), 101);"
"assert_eq!(i128::MAX.saturating_add(100), i128::MAX);"
"assert_eq!(i128::MIN.saturating_add(-1), i128::MIN);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::saturating_add(self, rhs);
"assert_eq!(1i128.saturating_add_unsigned(2), 3);"
"assert_eq!(i128::MAX.saturating_add_unsigned(100), i128::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Self
match self.checked_add_unsigned(rhs) { Some(x) => x, None => Self::MAX, }
"assert_eq!(100i128.saturating_sub(127), -27);"
"assert_eq!(i128::MIN.saturating_sub(100), i128::MIN);"
"assert_eq!(i128::MAX.saturating_sub(-1), i128::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::saturating_sub(self, rhs);
"assert_eq!(100i128.saturating_sub_unsigned(127), -27);"
"assert_eq!(i128::MIN.saturating_sub_unsigned(100), i128::MIN);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Self
match self.checked_sub_unsigned(rhs) { Some(x) => x, None => Self::MIN, }
"assert_eq!(100i128.saturating_neg(), -100);"
"assert_eq!((-100i128).saturating_neg(), 100);"
"assert_eq!(i128::MIN.saturating_neg(), i128::MAX);"
"assert_eq!(i128::MAX.saturating_neg(), i128::MIN + 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
intrinsics::saturating_sub(0, self);
"assert_eq!(100i128.saturating_abs(), 100);"
"assert_eq!((-100i128).saturating_abs(), 100);"
"assert_eq!(i128::MIN.saturating_abs(), i128::MAX);"
"assert_eq!((i128::MIN + 1).saturating_abs(), i128::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
if self.is_negative() { self.saturating_neg() } else { self }
"assert_eq!(10i128.saturating_mul(12), 120);"
"assert_eq!(i128::MAX.saturating_mul(10), i128::MAX);"
"assert_eq!(i128::MIN.saturating_mul(10), i128::MIN);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
match self.checked_mul(rhs) {
    Some(x) => x,
    None => if (self < 0) == (rhs < 0) { Self::MAX } else { Self::MIN },
}
"assert_eq!(5i128.saturating_div(2), 2);"
"assert_eq!(i128::MAX.saturating_div(-1), i128::MIN + 1);"
"assert_eq!(i128::MIN.saturating_div(-1), i128::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
match self.overflowing_div(rhs) {
    (result, false) => result,
    (_result, true) => Self::MAX,
}
"assert_eq!((-4i128).saturating_pow(3), -64);"
"assert_eq!(0_i128.saturating_pow(0), 1);"
"assert_eq!(i128::MIN.saturating_pow(2), i128::MAX);"
"assert_eq!(i128::MIN.saturating_pow(3), i128::MIN);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
exp
Self
match self.checked_pow(exp) {
    Some(x) => x,
    None if self < 0 && exp % 2 == 1 => Self::MIN,
    None => Self::MAX,
}
"assert_eq!(100i128.wrapping_add(27), 127);"
"assert_eq!(i128::MAX.wrapping_add(2), i128::MIN + 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::wrapping_add(self, rhs);
"assert_eq!(100i128.wrapping_add_unsigned(27), 127);"
"assert_eq!(i128::MAX.wrapping_add_unsigned(2), i128::MIN + 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Self
self.wrapping_add(rhs as Self);
"assert_eq!(0i128.wrapping_sub(127), -127);"
"assert_eq!((-2i128).wrapping_sub(i128::MAX), i128::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::wrapping_sub(self, rhs);
"assert_eq!(0i128.wrapping_sub_unsigned(127), -127);"
"assert_eq!((-2i128).wrapping_sub_unsigned(u128::MAX), -1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
Self
self.wrapping_sub(rhs as Self);
"assert_eq!(10i128.wrapping_mul(12), 120);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::wrapping_mul(self, rhs);
"assert_eq!(100i128.wrapping_div(10), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self.overflowing_div(rhs).0;
"assert_eq!(100i128.wrapping_div_euclid(10), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self.overflowing_div_euclid(rhs).0;
"assert_eq!(100i128.wrapping_rem(10), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self.overflowing_rem(rhs).0;
"assert_eq!(100i128.wrapping_rem_euclid(10), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self.overflowing_rem_euclid(rhs).0;
"assert_eq!(100i128.wrapping_neg(), -100);"
"assert_eq!((-100i128).wrapping_neg(), 100);"
"assert_eq!(i128::MIN.wrapping_neg(), i128::MIN);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
(0 as i128).wrapping_sub(self);
"assert_eq!((-1_i128).wrapping_shl(7), -128);"
"assert_eq!(42_i128.wrapping_shl(128), 42);"
"assert_eq!(42_i128.wrapping_shl(1).wrapping_shl(127), 0);"
"assert_eq!((-1_i128).wrapping_shl(128), -1);"
"assert_eq!(5_i128.wrapping_shl(1025), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
unsafe { self.unchecked_shl(rhs & (Self::BITS - 1)) }
"assert_eq!((-128_i128).wrapping_shr(7), -1);"
"assert_eq!(42_i128.wrapping_shr(128), 42);"
"assert_eq!(42_i128.wrapping_shr(1).wrapping_shr(127), 0);"
"assert_eq!(10_i128.wrapping_shr(1025), 5);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
unsafe { self.unchecked_shr(rhs & (Self::BITS - 1)) }
"assert_eq!(100i128.wrapping_abs(), 100);"
"assert_eq!((-100i128).wrapping_abs(), 100);"
"assert_eq!(i128::MIN.wrapping_abs(), i128::MIN);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
if self.is_negative() { self.wrapping_neg() } else { self }
"assert_eq!(100i128.unsigned_abs(), 100u128);"
"assert_eq!((-100i128).unsigned_abs(), 100u128);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
self.wrapping_abs() as u128;
"assert_eq!(3i128.wrapping_pow(4), 81);"
"assert_eq!(0_i128.wrapping_pow(0), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Self
if exp == 0 { return 1; }
let mut base = self;
let mut acc: Self = 1;
if intrinsics::is_val_statically_known(exp) {
    while exp > 1 {
        if (exp & 1) == 1 { acc = acc.wrapping_mul(base); }
        exp /= 2;
        base = base.wrapping_mul(base);
    }
    acc.wrapping_mul(base)
} else {
    loop {
        if (exp & 1) == 1 {
            acc = acc.wrapping_mul(base);
            if exp == 1 { return acc; }
        }
        exp /= 2;
        base = base.wrapping_mul(base);
    }
}
"assert_eq!(5i128.overflowing_add(2), (7, false));"
"assert_eq!(i128::MAX.overflowing_add(1), (i128::MIN, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
let (a, b) = intrinsics::add_with_overflow(self as i128, rhs as i128);
(a as Self, b);
"[`u128::carrying_add`]"
"//   10  MAX    (a = 10 \u{d7} 2^128 + 2^128 - 1)"
"// + -5    9    (b = -5 \u{d7} 2^128 + 9)"
"//    6    8    (sum = 6 \u{d7} 2^128 + 8)"
"let (a1, a0): (i128, u128) = (10, u128::MAX);"
"let (b1, b0): (i128, u128) = (-5, 9);"
"// u128::carrying_add for the less significant words"
"// i128::carrying_add for the most significant word"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
bool
carry
(Self, bool)
let (a, b) = self.overflowing_add(rhs);
let (c, d) = a.overflowing_add(carry as i128);
(c, b != d);
"assert_eq!(1i128.overflowing_add_unsigned(2), (3, false));"
"assert_eq!((i128::MIN).overflowing_add_unsigned(u128::MAX), (i128::MAX, false));"
"assert_eq!((i128::MAX - 2).overflowing_add_unsigned(3), (i128::MIN, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
(Self, bool)
let rhs = rhs as Self;
let (res, overflowed) = self.overflowing_add(rhs);
(res, overflowed ^ (rhs < 0));
"assert_eq!(5i128.overflowing_sub(2), (3, false));"
"assert_eq!(i128::MIN.overflowing_sub(1), (i128::MAX, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
let (a, b) = intrinsics::sub_with_overflow(self as i128, rhs as i128);
(a as Self, b);
"[`u128::borrowing_sub`]"
"//    6    8    (a = 6 \u{d7} 2^128 + 8)"
"// - -5    9    (b = -5 \u{d7} 2^128 + 9)"
"//   10  MAX    (diff = 10 \u{d7} 2^128 + 2^128 - 1)"
"let (a1, a0): (i128, u128) = (6, 8);"
"let (b1, b0): (i128, u128) = (-5, 9);"
"// u128::borrowing_sub for the less significant words"
"// i128::borrowing_sub for the most significant word"
"assert_eq!((diff1, diff0), (10, u128::MAX));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
bool
borrow
(Self, bool)
let (a, b) = self.overflowing_sub(rhs);
let (c, d) = a.overflowing_sub(borrow as i128);
(c, b != d);
"assert_eq!(1i128.overflowing_sub_unsigned(2), (-1, false));"
"assert_eq!((i128::MAX).overflowing_sub_unsigned(u128::MAX), (i128::MIN, false));"
"assert_eq!((i128::MIN + 2).overflowing_sub_unsigned(3), (i128::MAX, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
(Self, bool)
let rhs = rhs as Self;
let (res, overflowed) = self.overflowing_sub(rhs);
(res, overflowed ^ (rhs < 0));
"assert_eq!(5i128.overflowing_mul(2), (10, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
let (a, b) = intrinsics::mul_with_overflow(self as i128, rhs as i128);
(a as Self, b);
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(u128, Self)
Self::carrying_mul_add(self, rhs, 0, 0);
"assert_eq!(i128::MAX.carrying_mul(i128::MAX, i128::MAX), (i128::MAX.unsigned_abs() + 1, i128::MAX / 2));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
carry
(u128, Self)
Self::carrying_mul_add(self, rhs, carry, 0);
"assert_eq!(i128::MAX.carrying_mul_add(i128::MAX, i128::MAX, i128::MAX), (u128::MAX, i128::MAX / 2));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
carry
Self
add
(u128, Self)
intrinsics::carrying_mul_add(self, rhs, carry, add);
"assert_eq!(5i128.overflowing_div(2), (2, false));"
"assert_eq!(i128::MIN.overflowing_div(-1), (i128::MIN, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
if intrinsics::unlikely((self == Self::MIN) & (rhs == -1)) {
    (self, true)
} else { (self / rhs, false) }
"assert_eq!(5i128.overflowing_div_euclid(2), (2, false));"
"assert_eq!(i128::MIN.overflowing_div_euclid(-1), (i128::MIN, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
if intrinsics::unlikely((self == Self::MIN) & (rhs == -1)) {
    (self, true)
} else { (self.div_euclid(rhs), false) }
"assert_eq!(5i128.overflowing_rem(2), (1, false));"
"assert_eq!(i128::MIN.overflowing_rem(-1), (0, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
if intrinsics::unlikely(rhs == -1) {
    (0, self == Self::MIN)
} else { (self % rhs, false) }
"assert_eq!(5i128.overflowing_rem_euclid(2), (1, false));"
"assert_eq!(i128::MIN.overflowing_rem_euclid(-1), (0, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
if intrinsics::unlikely(rhs == -1) {
    (0, self == Self::MIN)
} else { (self.rem_euclid(rhs), false) }
"assert_eq!(2i128.overflowing_neg(), (-2, false));"
"assert_eq!(i128::MIN.overflowing_neg(), (i128::MIN, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
(Self, bool)
if intrinsics::unlikely(self == Self::MIN) {
    (Self::MIN, true)
} else { (-self, false) }
"assert_eq!(0x1i128.overflowing_shl(4), (0x10, false));"
"assert_eq!(0x10i128.overflowing_shl(127), (0, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
(Self, bool)
(self.wrapping_shl(rhs), rhs >= Self::BITS);
"assert_eq!(0x10i128.overflowing_shr(4), (0x1, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
(Self, bool)
(self.wrapping_shr(rhs), rhs >= Self::BITS);
"(e.g., i128::MIN for values of type i128),"
"assert_eq!(10i128.overflowing_abs(), (10, false));"
"assert_eq!((-10i128).overflowing_abs(), (10, false));"
"assert_eq!((i128::MIN).overflowing_abs(), (i128::MIN, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
(Self, bool)
(self.wrapping_abs(), self == Self::MIN);
"assert_eq!(3i128.overflowing_pow(4), (81, false));"
"assert_eq!(0_i128.overflowing_pow(0), (1, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
(Self, bool)
if exp == 0 { return (1, false); }
let mut base = self;
let mut acc: Self = 1;
let mut overflown = false;
let mut r;
loop {
    if (exp & 1) == 1 {
        r = acc.overflowing_mul(base);
        if exp == 1 { r.1 |= overflown; return r; }
        acc = r.0;
        overflown |= r.1;
    }
    exp /= 2;
    r = base.overflowing_mul(base);
    base = r.0;
    overflown |= r.1;
}
"let x: i128 = 2; // or any other integer type"
"assert_eq!(0_i128.pow(0), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Self
if exp == 0 { return 1; }
let mut base = self;
let mut acc = 1;
if intrinsics::is_val_statically_known(exp) {
    while exp > 1 {
        if (exp & 1) == 1 { acc = acc * base; }
        exp /= 2;
        base = base * base;
    }
    acc * base
} else {
    loop {
        if (exp & 1) == 1 { acc = acc * base; if exp == 1 { return acc; } }
        exp /= 2;
        base = base * base;
    }
}
"assert_eq!(10i128.isqrt(), 3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
match self.checked_isqrt() {
    Some(sqrt) => sqrt,
    None => imp::int_sqrt::panic_for_negative_argument(),
}
"let a: i128 = 7; // or any other integer type"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let q = self / rhs;
if self % rhs < 0 { return if rhs > 0 { q - 1 } else { q + 1 } }
q;
"let a: i128 = 7; // or any other integer type"
"let _ = i128::MIN.rem_euclid(-1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let r = self % rhs;
if r < 0 { r.wrapping_add(rhs.wrapping_abs()) } else { r }
"let a: i128 = 8;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let d = self / rhs;
let r = self % rhs;
let correction = (self ^ rhs) >> (Self::BITS - 1);
if r != 0 { d + correction } else { d }
"let a: i128 = 8;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let d = self / rhs;
let r = self % rhs;
let correction = 1 + ((self ^ rhs) >> (Self::BITS - 1));
if r != 0 { d + correction } else { d }
"assert_eq!(16_i128.next_multiple_of(8), 16);"
"assert_eq!(23_i128.next_multiple_of(8), 24);"
"assert_eq!(16_i128.next_multiple_of(-8), 16);"
"assert_eq!(23_i128.next_multiple_of(-8), 16);"
"assert_eq!((-16_i128).next_multiple_of(8), -16);"
"assert_eq!((-23_i128).next_multiple_of(8), -16);"
"assert_eq!((-16_i128).next_multiple_of(-8), -16);"
"assert_eq!((-23_i128).next_multiple_of(-8), -24);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
if rhs == -1 { return self; }
let r = self % rhs;
let m = if (r > 0 && rhs < 0) || (r < 0 && rhs > 0) { r + rhs } else { r };
if m == 0 { self } else { self + (rhs - m) }
"assert_eq!(16_i128.checked_next_multiple_of(8), Some(16));"
"assert_eq!(23_i128.checked_next_multiple_of(8), Some(24));"
"assert_eq!(16_i128.checked_next_multiple_of(-8), Some(16));"
"assert_eq!(23_i128.checked_next_multiple_of(-8), Some(16));"
"assert_eq!((-16_i128).checked_next_multiple_of(8), Some(-16));"
"assert_eq!((-23_i128).checked_next_multiple_of(8), Some(-16));"
"assert_eq!((-16_i128).checked_next_multiple_of(-8), Some(-16));"
"assert_eq!((-23_i128).checked_next_multiple_of(-8), Some(-24));"
"assert_eq!(1_i128.checked_next_multiple_of(0), None);"
"assert_eq!(i128::MAX.checked_next_multiple_of(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if rhs == -1 { return Some(self); }
let r = match self.checked_rem(rhs) { Some(x) => x, None => return None, };
let m = if (r > 0 && rhs < 0) || (r < 0 && rhs > 0) { r + rhs } else { r };
if m == 0 { Some(self) } else { self.checked_add(rhs - m) }
"assert_eq!(5i128.ilog(5), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
base
u32
if !(base >= 2) {
    {
        crate::panicking::panic_fmt(format_args!("base of integer logarithm must be at least 2"));
    }
};
if let Some(log) = self.checked_ilog(base) {
    log
} else { imp::int_log10::panic_for_nonpositive_argument() }
"assert_eq!(2i128.ilog2(), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
if let Some(log) = self.checked_ilog2() {
    log
} else { imp::int_log10::panic_for_nonpositive_argument() }
"assert_eq!(10i128.ilog10(), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
if let Some(log) = self.checked_ilog10() {
    log
} else { imp::int_log10::panic_for_nonpositive_argument() }
"assert_eq!(5i128.checked_ilog(5), Some(1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
base
Option<u32>
if self <= 0 || base <= 1 {
    None
} else { (self as u128).checked_ilog(base as u128) }
"assert_eq!(2i128.checked_ilog2(), Some(1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
if self <= 0 {
    None
} else {
    let log =
        (Self::BITS - 1) - unsafe { intrinsics::ctlz_nonzero(self) as u32 };
    Some(log)
}
"assert_eq!(10i128.checked_ilog10(), Some(1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
imp::int_log10::i128(self as i128);
"`i128::MIN`"
"`i128`,"
"`i128::MIN`"
"assert_eq!(10i128.abs(), 10);"
"assert_eq!((-10i128).abs(), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
if self.is_negative() { -self } else { self }
"assert_eq!(100i128.abs_diff(80), 20u128);"
"assert_eq!(100i128.abs_diff(110), 10u128);"
"assert_eq!((-100i128).abs_diff(80), 180u128);"
"assert_eq!((-100i128).abs_diff(-120), 20u128);"
"assert_eq!(i128::MIN.abs_diff(i128::MAX), u128::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
other
if self < other {
    (other as u128).wrapping_sub(self as u128)
} else { (self as u128).wrapping_sub(other as u128) }
"assert_eq!(10i128.signum(), 1);"
"assert_eq!(0i128.signum(), 0);"
"assert_eq!((-10i128).signum(), -1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
crate::intrinsics::three_way_compare(self, 0) as Self;
"assert!(10i128.is_positive());"
"assert!(!(-10i128).is_positive());"
Self
self
bool
self > 0;
"assert!((-10i128).is_negative());"
"assert!(!10i128.is_negative());"
Self
self
bool
self < 0;
"let bytes = 0x12345678901234567890123456789012i128.to_be_bytes();"
"assert_eq!(bytes, [0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12]);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
self.to_be().to_ne_bytes();
"let bytes = 0x12345678901234567890123456789012i128.to_le_bytes();"
"assert_eq!(bytes, [0x12, 0x90, 0x78, 0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
self.to_le().to_ne_bytes();
"let bytes = 0x12345678901234567890123456789012i128.to_ne_bytes();"
"        [0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12]"
"        [0x12, 0x90, 0x78, 0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
unsafe { mem::transmute(self) }
"let value = i128::from_be_bytes([0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12]);"
"assert_eq!(value, 0x12345678901234567890123456789012);"
"fn read_be_i128(input: &mut &[u8]) -> i128 {"
"    let (int_bytes, rest) = input.split_at(size_of::<i128>());"
"    i128::from_be_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
Self::from_be(Self::from_ne_bytes(bytes));
"let value = i128::from_le_bytes([0x12, 0x90, 0x78, 0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]);"
"assert_eq!(value, 0x12345678901234567890123456789012);"
"fn read_le_i128(input: &mut &[u8]) -> i128 {"
"    let (int_bytes, rest) = input.split_at(size_of::<i128>());"
"    i128::from_le_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
Self::from_le(Self::from_ne_bytes(bytes));
"let value = i128::from_ne_bytes(if cfg!(target_endian = \"big\") {"
"    [0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12]"
"    [0x12, 0x90, 0x78, 0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]"
"assert_eq!(value, 0x12345678901234567890123456789012);"
"fn read_ne_i128(input: &mut &[u8]) -> i128 {"
"    let (int_bytes, rest) = input.split_at(size_of::<i128>());"
"    i128::from_ne_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
unsafe { mem::transmute(bytes) }
"[`i128::MIN`] instead."
"i128_legacy_fn_min_value"
Self
Self::MIN;
"[`i128::MAX`] instead."
"i128_legacy_fn_max_value"
Self
Self::MAX;
"assert_eq!(120i128.clamp_magnitude(100), 100);"
"assert_eq!(-120i128.clamp_magnitude(100), -100);"
"assert_eq!(80i128.clamp_magnitude(100), 80);"
"assert_eq!(-80i128.clamp_magnitude(100), -80);"
"this returns the clamped value and does not modify the original"
Self
self
limit
Self
if let Ok(limit) = core::convert::TryInto::<i128>::try_into(limit) {
    self.clamp(-limit, limit)
} else { self }
"assert_eq!(120i8, 120i128.truncate());"
"assert_eq!(-120i8, (-120i128).truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Target
traits::TruncateTarget::internal_truncate(self);
"assert_eq!(120i8, 120i128.saturating_truncate());"
"assert_eq!(-120i8, (-120i128).saturating_truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Target
traits::TruncateTarget::internal_saturating_truncate(self);
"assert_eq!(Some(120i8), 120i128.checked_truncate());"
"assert_eq!(Some(-120i8), (-120i128).checked_truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Option<Target>
traits::TruncateTarget::internal_checked_truncate(self);
"assert_eq!(120i128, 120i8.extend());"
"assert_eq!(-120i128, (-120i8).extend());"
"this returns the extended value and does not modify the original"
Self
Target
Self
self
Target
traits::ExtendTarget::internal_extend(self);int_impl! {
439        Self = i128,
440        ActualT = i128,
441        UnsignedT = u128,
442        BITS = 128,
443        BITS_MINUS_ONE = 127,
444        Min = -170141183460469231731687303715884105728,
445        Max = 170141183460469231731687303715884105727,
446        rot = 16,
447        rot_op = "0x13f40000000000000000000000004f76",
448        rot_result = "0x4f7613f4",
449        swap_op = "0x12345678901234567890123456789012",
450        swapped = "0x12907856341290785634129078563412",
451        reversed = "0x48091e6a2c48091e6a2c48091e6a2c48",
452        le_bytes = "[0x12, 0x90, 0x78, 0x56, 0x34, 0x12, 0x90, 0x78, \
453            0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
454        be_bytes = "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, \
455            0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12]",
456        to_xe_bytes_doc = "",
457        from_xe_bytes_doc = "",
458        bound_condition = "",
459    }
460    "assert_eq!(0i128.midpoint(4), 2);"
"assert_eq!((-1i128).midpoint(2), 0);"
"assert_eq!((-7i128).midpoint(0), -3);"
"assert_eq!(0i128.midpoint(-7), -3);"
"assert_eq!(0i128.midpoint(7), 3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let t = ((self ^ rhs) >> 1) + (self & rhs);
t + (if t < 0 { 1 } else { 0 } & (self ^ rhs));midpoint_impl! { i128, signed }
461}
462
463#[cfg(target_pointer_width = "16")]
464impl isize {
465    int_impl! {
466        Self = isize,
467        ActualT = i16,
468        UnsignedT = usize,
469        BITS = 16,
470        BITS_MINUS_ONE = 15,
471        Min = -32768,
472        Max = 32767,
473        rot = 4,
474        rot_op = "-0x5ffd",
475        rot_result = "0x3a",
476        swap_op = "0x1234",
477        swapped = "0x3412",
478        reversed = "0x2c48",
479        le_bytes = "[0x34, 0x12]",
480        be_bytes = "[0x12, 0x34]",
481        to_xe_bytes_doc = usize_isize_to_xe_bytes_doc!(),
482        from_xe_bytes_doc = usize_isize_from_xe_bytes_doc!(),
483        bound_condition = " on 16-bit targets",
484    }
485    midpoint_impl! { isize, i32, signed }
486}
487
488#[cfg(target_pointer_width = "32")]
489impl isize {
490    int_impl! {
491        Self = isize,
492        ActualT = i32,
493        UnsignedT = usize,
494        BITS = 32,
495        BITS_MINUS_ONE = 31,
496        Min = -2147483648,
497        Max = 2147483647,
498        rot = 8,
499        rot_op = "0x10000b3",
500        rot_result = "0xb301",
501        swap_op = "0x12345678",
502        swapped = "0x78563412",
503        reversed = "0x1e6a2c48",
504        le_bytes = "[0x78, 0x56, 0x34, 0x12]",
505        be_bytes = "[0x12, 0x34, 0x56, 0x78]",
506        to_xe_bytes_doc = usize_isize_to_xe_bytes_doc!(),
507        from_xe_bytes_doc = usize_isize_from_xe_bytes_doc!(),
508        bound_condition = " on 32-bit targets",
509    }
510    midpoint_impl! { isize, i64, signed }
511}
512
513#[cfg(target_pointer_width = "64")]
514impl isize {
515    int_impl! {
516        Self = isize,
517        ActualT = i64,
518        UnsignedT = usize,
519        BITS = 64,
520        BITS_MINUS_ONE = 63,
521        Min = -9223372036854775808,
522        Max = 9223372036854775807,
523        rot = 12,
524        rot_op = "0xaa00000000006e1",
525        rot_result = "0x6e10aa",
526        swap_op = "0x1234567890123456",
527        swapped = "0x5634129078563412",
528        reversed = "0x6a2c48091e6a2c48",
529        le_bytes = "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
530        be_bytes = "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]",
531        to_xe_bytes_doc = "

**Note**: This function returns an array of length 2, 4 or 8 bytes
depending on the target pointer size.

"
"let bytes = 0x1234567890123456isize.to_ne_bytes();"
"        [0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]"
"        [0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
unsafe { mem::transmute(self) }
"let value = isize::from_be_bytes([0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]);"
"assert_eq!(value, 0x1234567890123456);"
"fn read_be_isize(input: &mut &[u8]) -> isize {"
"    let (int_bytes, rest) = input.split_at(size_of::<isize>());"
"    isize::from_be_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
Self::from_be(Self::from_ne_bytes(bytes));
"let value = isize::from_le_bytes([0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]);"
"assert_eq!(value, 0x1234567890123456);"
"fn read_le_isize(input: &mut &[u8]) -> isize {"
"    let (int_bytes, rest) = input.split_at(size_of::<isize>());"
"    isize::from_le_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
Self::from_le(Self::from_ne_bytes(bytes));
"let value = isize::from_ne_bytes(if cfg!(target_endian = \"big\") {"
"    [0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]"
"    [0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]"
"assert_eq!(value, 0x1234567890123456);"
"fn read_ne_isize(input: &mut &[u8]) -> isize {"
"    let (int_bytes, rest) = input.split_at(size_of::<isize>());"
"    isize::from_ne_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
unsafe { mem::transmute(bytes) }
"[`isize::MIN`] instead."
"isize_legacy_fn_min_value"
Self
Self::MIN;
"[`isize::MAX`] instead."
"isize_legacy_fn_max_value"
Self
Self::MAX;
"assert_eq!(120isize.clamp_magnitude(100), 100);"
"assert_eq!(-120isize.clamp_magnitude(100), -100);"
"assert_eq!(80isize.clamp_magnitude(100), 80);"
"assert_eq!(-80isize.clamp_magnitude(100), -80);"
"this returns the clamped value and does not modify the original"
Self
self
limit
Self
if let Ok(limit) = core::convert::TryInto::<isize>::try_into(limit) {
    self.clamp(-limit, limit)
} else { self }
"assert_eq!(120i8, 120isize.truncate());"
"assert_eq!(-120i8, (-120isize).truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Target
traits::TruncateTarget::internal_truncate(self);
"assert_eq!(120i8, 120isize.saturating_truncate());"
"assert_eq!(-120i8, (-120isize).saturating_truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Target
traits::TruncateTarget::internal_saturating_truncate(self);
"assert_eq!(Some(120i8), 120isize.checked_truncate());"
"assert_eq!(Some(-120i8), (-120isize).checked_truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Option<Target>
traits::TruncateTarget::internal_checked_truncate(self);
"assert_eq!(120i128, 120i8.extend());"
"assert_eq!(-120i128, (-120i8).extend());"
"this returns the extended value and does not modify the original"
Self
Target
Self
self
Target
traits::ExtendTarget::internal_extend(self);usize_isize_to_xe_bytes_doc!(),
532        from_xe_bytes_doc = "

**Note**: This function takes an array of length 2, 4 or 8 bytes
depending on the target pointer size.

"usize_isize_from_xe_bytes_doc!(),
533        bound_condition = " on 64-bit targets",
534    }
535    "assert_eq!(0isize.midpoint(4), 2);"
"assert_eq!((-1isize).midpoint(2), 0);"
"assert_eq!((-7isize).midpoint(0), -3);"
"assert_eq!(0isize.midpoint(-7), -3);"
"assert_eq!(0isize.midpoint(7), 3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let t = ((self ^ rhs) >> 1) + (self & rhs);
t + (if t < 0 { 1 } else { 0 } & (self ^ rhs));midpoint_impl! { isize, signed }
536}
537
538/// If the bit selected by this mask is set, ascii is lower case.
539const ASCII_CASE_MASK: u8 = 0b0010_0000;
540
541impl u8 {
542    uint_impl! {
543        Self = u8,
544        ActualT = u8,
545        SignedT = i8,
546        BITS = 8,
547        BITS_MINUS_ONE = 7,
548        MAX = 255,
549        rot = 2,
550        rot_op = "0x82",
551        rot_result = "0xa",
552        fsh_op = "0x36",
553        fshl_result = "0x8",
554        fshr_result = "0x8d",
555        clmul_lhs = "0x12",
556        clmul_rhs = "0x34",
557        clmul_result = "0x28",
558        swap_op = "0x12",
559        swapped = "0x12",
560        reversed = "0x48",
561        le_bytes = "[0x12]",
562        be_bytes = "[0x12]",
563        to_xe_bytes_doc = "

**Note**: This function is meaningless on `u8`. Byte order does not exist as a
concept for byte-sized integers. This function is only provided in symmetry
with larger integer types.

"
"let bytes = 0x12u8.to_ne_bytes();"
"        [0x12]"
"        [0x12]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
unsafe { mem::transmute(self) }
"let value = u8::from_be_bytes([0x12]);"
"assert_eq!(value, 0x12);"
"fn read_be_u8(input: &mut &[u8]) -> u8 {"
"    let (int_bytes, rest) = input.split_at(size_of::<u8>());"
"    u8::from_be_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
Self::from_be(Self::from_ne_bytes(bytes));
"let value = u8::from_le_bytes([0x12]);"
"assert_eq!(value, 0x12);"
"fn read_le_u8(input: &mut &[u8]) -> u8 {"
"    let (int_bytes, rest) = input.split_at(size_of::<u8>());"
"    u8::from_le_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
Self::from_le(Self::from_ne_bytes(bytes));
"let value = u8::from_ne_bytes(if cfg!(target_endian = \"big\") {"
"    [0x12]"
"    [0x12]"
"assert_eq!(value, 0x12);"
"fn read_ne_u8(input: &mut &[u8]) -> u8 {"
"    let (int_bytes, rest) = input.split_at(size_of::<u8>());"
"    u8::from_ne_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
unsafe { mem::transmute(bytes) }
"[`u8::MIN`] instead."
"u8_legacy_fn_min_value"
Self
Self::MIN;
"[`u8::MAX`] instead."
"u8_legacy_fn_max_value"
Self
Self::MAX;
"assert_eq!(120u8, 120u8.truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Target
traits::TruncateTarget::internal_truncate(self);
"assert_eq!(120u8, 120u8.saturating_truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Target
traits::TruncateTarget::internal_saturating_truncate(self);
"assert_eq!(Some(120u8), 120u8.checked_truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Option<Target>
traits::TruncateTarget::internal_checked_truncate(self);
"assert_eq!(120u128, 120u8.extend());"
"this returns the extended value and does not modify the original"
Self
Target
Self
self
Target
traits::ExtendTarget::internal_extend(self);u8_xe_bytes_doc!(),
564        from_xe_bytes_doc = "

**Note**: This function is meaningless on `u8`. Byte order does not exist as a
concept for byte-sized integers. This function is only provided in symmetry
with larger integer types.

"u8_xe_bytes_doc!(),
565        bound_condition = "",
566    }
567    "assert_eq!(0u8.midpoint(4), 2);"
"assert_eq!(1u8.midpoint(4), 2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
((self as u16 + rhs as u16) / 2) as u8;midpoint_impl! { u8, u16, unsigned }
568    "assert_eq!(u8::MAX.widening_carryless_mul(u8::MAX), u16::MAX / 3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
(self as u16).carryless_mul(rhs as u16);widening_carryless_mul_impl! { u8, u16 }
569    self
Self
rhs
Self
carry
(Self, Self)
let p = (self as u16).carryless_mul(rhs as u16);
let lo = (p as u8);
let hi = (p >> Self::BITS) as u8;
(lo ^ carry, hi);carrying_carryless_mul_impl! { u8, u16 }
570
571    /// Checks if the value is within the ASCII range.
572    ///
573    /// # Examples
574    ///
575    /// ```
576    /// let ascii = 97u8;
577    /// let non_ascii = 150u8;
578    ///
579    /// assert!(ascii.is_ascii());
580    /// assert!(!non_ascii.is_ascii());
581    /// ```
582    #[must_use]
583    #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
584    #[rustc_const_stable(feature = "const_u8_is_ascii", since = "1.43.0")]
585    #[inline]
586    pub const fn is_ascii(&self) -> bool {
587        *self <= 127
588    }
589
590    /// If the value of this byte is within the ASCII range, returns it as an
591    /// [ASCII character](ascii::Char).  Otherwise, returns `None`.
592    #[must_use]
593    #[unstable(feature = "ascii_char", issue = "110998")]
594    #[inline]
595    pub const fn as_ascii(&self) -> Option<ascii::Char> {
596        ascii::Char::from_u8(*self)
597    }
598
599    /// Converts this byte to an [ASCII character](ascii::Char), without
600    /// checking whether or not it's valid.
601    ///
602    /// # Safety
603    ///
604    /// This byte must be valid ASCII, or else this is UB.
605    #[must_use]
606    #[unstable(feature = "ascii_char", issue = "110998")]
607    #[inline]
608    pub const unsafe fn as_ascii_unchecked(&self) -> ascii::Char {
609        {
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(it: &u8) {
        if !it.is_ascii() {
            let msg =
                "unsafe precondition(s) violated: as_ascii_unchecked requires that the byte is valid ASCII\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_library_ub() { precondition_check(self); }
};assert_unsafe_precondition!(
610            check_library_ub,
611            "as_ascii_unchecked requires that the byte is valid ASCII",
612            (it: &u8 = self) => it.is_ascii()
613        );
614
615        // SAFETY: the caller promised that this byte is ASCII.
616        unsafe { ascii::Char::from_u8_unchecked(*self) }
617    }
618
619    /// Makes a copy of the value in its ASCII upper case equivalent.
620    ///
621    /// ASCII letters 'a' to 'z' are mapped to 'A' to 'Z',
622    /// but non-ASCII letters are unchanged.
623    ///
624    /// To uppercase the value in-place, use [`make_ascii_uppercase`].
625    ///
626    /// # Examples
627    ///
628    /// ```
629    /// let lowercase_a = 97u8;
630    ///
631    /// assert_eq!(65, lowercase_a.to_ascii_uppercase());
632    /// ```
633    ///
634    /// [`make_ascii_uppercase`]: Self::make_ascii_uppercase
635    #[must_use = "to uppercase the value in-place, use `make_ascii_uppercase()`"]
636    #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
637    #[rustc_const_stable(feature = "const_ascii_methods_on_intrinsics", since = "1.52.0")]
638    #[inline]
639    pub const fn to_ascii_uppercase(&self) -> u8 {
640        // Toggle the 6th bit if this is a lowercase letter
641        *self ^ ((self.is_ascii_lowercase() as u8) * ASCII_CASE_MASK)
642    }
643
644    /// Makes a copy of the value in its ASCII lower case equivalent.
645    ///
646    /// ASCII letters 'A' to 'Z' are mapped to 'a' to 'z',
647    /// but non-ASCII letters are unchanged.
648    ///
649    /// To lowercase the value in-place, use [`make_ascii_lowercase`].
650    ///
651    /// # Examples
652    ///
653    /// ```
654    /// let uppercase_a = 65u8;
655    ///
656    /// assert_eq!(97, uppercase_a.to_ascii_lowercase());
657    /// ```
658    ///
659    /// [`make_ascii_lowercase`]: Self::make_ascii_lowercase
660    #[must_use = "to lowercase the value in-place, use `make_ascii_lowercase()`"]
661    #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
662    #[rustc_const_stable(feature = "const_ascii_methods_on_intrinsics", since = "1.52.0")]
663    #[inline]
664    pub const fn to_ascii_lowercase(&self) -> u8 {
665        // Set the 6th bit if this is an uppercase letter
666        *self | (self.is_ascii_uppercase() as u8 * ASCII_CASE_MASK)
667    }
668
669    /// Assumes self is ascii
670    #[inline]
671    pub(crate) const fn ascii_change_case_unchecked(&self) -> u8 {
672        *self ^ ASCII_CASE_MASK
673    }
674
675    /// Checks that two values are an ASCII case-insensitive match.
676    ///
677    /// This is equivalent to `to_ascii_lowercase(a) == to_ascii_lowercase(b)`.
678    ///
679    /// # Examples
680    ///
681    /// ```
682    /// let lowercase_a = 97u8;
683    /// let uppercase_a = 65u8;
684    ///
685    /// assert!(lowercase_a.eq_ignore_ascii_case(&uppercase_a));
686    /// ```
687    #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
688    #[rustc_const_stable(feature = "const_ascii_methods_on_intrinsics", since = "1.52.0")]
689    #[inline]
690    pub const fn eq_ignore_ascii_case(&self, other: &u8) -> bool {
691        self.to_ascii_lowercase() == other.to_ascii_lowercase()
692    }
693
694    /// Converts this value to its ASCII upper case equivalent in-place.
695    ///
696    /// ASCII letters 'a' to 'z' are mapped to 'A' to 'Z',
697    /// but non-ASCII letters are unchanged.
698    ///
699    /// To return a new uppercased value without modifying the existing one, use
700    /// [`to_ascii_uppercase`].
701    ///
702    /// # Examples
703    ///
704    /// ```
705    /// let mut byte = b'a';
706    ///
707    /// byte.make_ascii_uppercase();
708    ///
709    /// assert_eq!(b'A', byte);
710    /// ```
711    ///
712    /// [`to_ascii_uppercase`]: Self::to_ascii_uppercase
713    #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
714    #[rustc_const_stable(feature = "const_make_ascii", since = "1.84.0")]
715    #[inline]
716    pub const fn make_ascii_uppercase(&mut self) {
717        *self = self.to_ascii_uppercase();
718    }
719
720    /// Converts this value to its ASCII lower case equivalent in-place.
721    ///
722    /// ASCII letters 'A' to 'Z' are mapped to 'a' to 'z',
723    /// but non-ASCII letters are unchanged.
724    ///
725    /// To return a new lowercased value without modifying the existing one, use
726    /// [`to_ascii_lowercase`].
727    ///
728    /// # Examples
729    ///
730    /// ```
731    /// let mut byte = b'A';
732    ///
733    /// byte.make_ascii_lowercase();
734    ///
735    /// assert_eq!(b'a', byte);
736    /// ```
737    ///
738    /// [`to_ascii_lowercase`]: Self::to_ascii_lowercase
739    #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
740    #[rustc_const_stable(feature = "const_make_ascii", since = "1.84.0")]
741    #[inline]
742    pub const fn make_ascii_lowercase(&mut self) {
743        *self = self.to_ascii_lowercase();
744    }
745
746    /// Checks if the value is an ASCII alphabetic character:
747    ///
748    /// - U+0041 'A' ..= U+005A 'Z', or
749    /// - U+0061 'a' ..= U+007A 'z'.
750    ///
751    /// # Examples
752    ///
753    /// ```
754    /// let uppercase_a = b'A';
755    /// let uppercase_g = b'G';
756    /// let a = b'a';
757    /// let g = b'g';
758    /// let zero = b'0';
759    /// let percent = b'%';
760    /// let space = b' ';
761    /// let lf = b'\n';
762    /// let esc = b'\x1b';
763    ///
764    /// assert!(uppercase_a.is_ascii_alphabetic());
765    /// assert!(uppercase_g.is_ascii_alphabetic());
766    /// assert!(a.is_ascii_alphabetic());
767    /// assert!(g.is_ascii_alphabetic());
768    /// assert!(!zero.is_ascii_alphabetic());
769    /// assert!(!percent.is_ascii_alphabetic());
770    /// assert!(!space.is_ascii_alphabetic());
771    /// assert!(!lf.is_ascii_alphabetic());
772    /// assert!(!esc.is_ascii_alphabetic());
773    /// ```
774    #[must_use]
775    #[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
776    #[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
777    #[inline]
778    pub const fn is_ascii_alphabetic(&self) -> bool {
779        #[allow(non_exhaustive_omitted_patterns)] match *self {
    b'A'..=b'Z' | b'a'..=b'z' => true,
    _ => false,
}matches!(*self, b'A'..=b'Z' | b'a'..=b'z')
780    }
781
782    /// Checks if the value is an ASCII uppercase character:
783    /// U+0041 'A' ..= U+005A 'Z'.
784    ///
785    /// # Examples
786    ///
787    /// ```
788    /// let uppercase_a = b'A';
789    /// let uppercase_g = b'G';
790    /// let a = b'a';
791    /// let g = b'g';
792    /// let zero = b'0';
793    /// let percent = b'%';
794    /// let space = b' ';
795    /// let lf = b'\n';
796    /// let esc = b'\x1b';
797    ///
798    /// assert!(uppercase_a.is_ascii_uppercase());
799    /// assert!(uppercase_g.is_ascii_uppercase());
800    /// assert!(!a.is_ascii_uppercase());
801    /// assert!(!g.is_ascii_uppercase());
802    /// assert!(!zero.is_ascii_uppercase());
803    /// assert!(!percent.is_ascii_uppercase());
804    /// assert!(!space.is_ascii_uppercase());
805    /// assert!(!lf.is_ascii_uppercase());
806    /// assert!(!esc.is_ascii_uppercase());
807    /// ```
808    #[must_use]
809    #[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
810    #[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
811    #[inline]
812    pub const fn is_ascii_uppercase(&self) -> bool {
813        #[allow(non_exhaustive_omitted_patterns)] match *self {
    b'A'..=b'Z' => true,
    _ => false,
}matches!(*self, b'A'..=b'Z')
814    }
815
816    /// Checks if the value is an ASCII lowercase character:
817    /// U+0061 'a' ..= U+007A 'z'.
818    ///
819    /// # Examples
820    ///
821    /// ```
822    /// let uppercase_a = b'A';
823    /// let uppercase_g = b'G';
824    /// let a = b'a';
825    /// let g = b'g';
826    /// let zero = b'0';
827    /// let percent = b'%';
828    /// let space = b' ';
829    /// let lf = b'\n';
830    /// let esc = b'\x1b';
831    ///
832    /// assert!(!uppercase_a.is_ascii_lowercase());
833    /// assert!(!uppercase_g.is_ascii_lowercase());
834    /// assert!(a.is_ascii_lowercase());
835    /// assert!(g.is_ascii_lowercase());
836    /// assert!(!zero.is_ascii_lowercase());
837    /// assert!(!percent.is_ascii_lowercase());
838    /// assert!(!space.is_ascii_lowercase());
839    /// assert!(!lf.is_ascii_lowercase());
840    /// assert!(!esc.is_ascii_lowercase());
841    /// ```
842    #[must_use]
843    #[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
844    #[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
845    #[inline]
846    pub const fn is_ascii_lowercase(&self) -> bool {
847        #[allow(non_exhaustive_omitted_patterns)] match *self {
    b'a'..=b'z' => true,
    _ => false,
}matches!(*self, b'a'..=b'z')
848    }
849
850    /// Checks if the value is an ASCII alphanumeric character:
851    ///
852    /// - U+0041 'A' ..= U+005A 'Z', or
853    /// - U+0061 'a' ..= U+007A 'z', or
854    /// - U+0030 '0' ..= U+0039 '9'.
855    ///
856    /// # Examples
857    ///
858    /// ```
859    /// let uppercase_a = b'A';
860    /// let uppercase_g = b'G';
861    /// let a = b'a';
862    /// let g = b'g';
863    /// let zero = b'0';
864    /// let percent = b'%';
865    /// let space = b' ';
866    /// let lf = b'\n';
867    /// let esc = b'\x1b';
868    ///
869    /// assert!(uppercase_a.is_ascii_alphanumeric());
870    /// assert!(uppercase_g.is_ascii_alphanumeric());
871    /// assert!(a.is_ascii_alphanumeric());
872    /// assert!(g.is_ascii_alphanumeric());
873    /// assert!(zero.is_ascii_alphanumeric());
874    /// assert!(!percent.is_ascii_alphanumeric());
875    /// assert!(!space.is_ascii_alphanumeric());
876    /// assert!(!lf.is_ascii_alphanumeric());
877    /// assert!(!esc.is_ascii_alphanumeric());
878    /// ```
879    #[must_use]
880    #[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
881    #[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
882    #[inline]
883    pub const fn is_ascii_alphanumeric(&self) -> bool {
884        #[allow(non_exhaustive_omitted_patterns)] match *self {
    b'0'..=b'9' => true,
    _ => false,
}matches!(*self, b'0'..=b'9') | #[allow(non_exhaustive_omitted_patterns)] match *self {
    b'A'..=b'Z' => true,
    _ => false,
}matches!(*self, b'A'..=b'Z') | #[allow(non_exhaustive_omitted_patterns)] match *self {
    b'a'..=b'z' => true,
    _ => false,
}matches!(*self, b'a'..=b'z')
885    }
886
887    /// Checks if the value is an ASCII decimal digit:
888    /// U+0030 '0' ..= U+0039 '9'.
889    ///
890    /// # Examples
891    ///
892    /// ```
893    /// let uppercase_a = b'A';
894    /// let uppercase_g = b'G';
895    /// let a = b'a';
896    /// let g = b'g';
897    /// let zero = b'0';
898    /// let percent = b'%';
899    /// let space = b' ';
900    /// let lf = b'\n';
901    /// let esc = b'\x1b';
902    ///
903    /// assert!(!uppercase_a.is_ascii_digit());
904    /// assert!(!uppercase_g.is_ascii_digit());
905    /// assert!(!a.is_ascii_digit());
906    /// assert!(!g.is_ascii_digit());
907    /// assert!(zero.is_ascii_digit());
908    /// assert!(!percent.is_ascii_digit());
909    /// assert!(!space.is_ascii_digit());
910    /// assert!(!lf.is_ascii_digit());
911    /// assert!(!esc.is_ascii_digit());
912    /// ```
913    #[must_use]
914    #[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
915    #[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
916    #[inline]
917    pub const fn is_ascii_digit(&self) -> bool {
918        #[allow(non_exhaustive_omitted_patterns)] match *self {
    b'0'..=b'9' => true,
    _ => false,
}matches!(*self, b'0'..=b'9')
919    }
920
921    /// Checks if the value is an ASCII octal digit:
922    /// U+0030 '0' ..= U+0037 '7'.
923    ///
924    /// # Examples
925    ///
926    /// ```
927    /// #![feature(is_ascii_octdigit)]
928    ///
929    /// let uppercase_a = b'A';
930    /// let a = b'a';
931    /// let zero = b'0';
932    /// let seven = b'7';
933    /// let nine = b'9';
934    /// let percent = b'%';
935    /// let lf = b'\n';
936    ///
937    /// assert!(!uppercase_a.is_ascii_octdigit());
938    /// assert!(!a.is_ascii_octdigit());
939    /// assert!(zero.is_ascii_octdigit());
940    /// assert!(seven.is_ascii_octdigit());
941    /// assert!(!nine.is_ascii_octdigit());
942    /// assert!(!percent.is_ascii_octdigit());
943    /// assert!(!lf.is_ascii_octdigit());
944    /// ```
945    #[must_use]
946    #[unstable(feature = "is_ascii_octdigit", issue = "101288")]
947    #[inline]
948    pub const fn is_ascii_octdigit(&self) -> bool {
949        #[allow(non_exhaustive_omitted_patterns)] match *self {
    b'0'..=b'7' => true,
    _ => false,
}matches!(*self, b'0'..=b'7')
950    }
951
952    /// Checks if the value is an ASCII hexadecimal digit:
953    ///
954    /// - U+0030 '0' ..= U+0039 '9', or
955    /// - U+0041 'A' ..= U+0046 'F', or
956    /// - U+0061 'a' ..= U+0066 'f'.
957    ///
958    /// # Examples
959    ///
960    /// ```
961    /// let uppercase_a = b'A';
962    /// let uppercase_g = b'G';
963    /// let a = b'a';
964    /// let g = b'g';
965    /// let zero = b'0';
966    /// let percent = b'%';
967    /// let space = b' ';
968    /// let lf = b'\n';
969    /// let esc = b'\x1b';
970    ///
971    /// assert!(uppercase_a.is_ascii_hexdigit());
972    /// assert!(!uppercase_g.is_ascii_hexdigit());
973    /// assert!(a.is_ascii_hexdigit());
974    /// assert!(!g.is_ascii_hexdigit());
975    /// assert!(zero.is_ascii_hexdigit());
976    /// assert!(!percent.is_ascii_hexdigit());
977    /// assert!(!space.is_ascii_hexdigit());
978    /// assert!(!lf.is_ascii_hexdigit());
979    /// assert!(!esc.is_ascii_hexdigit());
980    /// ```
981    #[must_use]
982    #[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
983    #[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
984    #[inline]
985    pub const fn is_ascii_hexdigit(&self) -> bool {
986        #[allow(non_exhaustive_omitted_patterns)] match *self {
    b'0'..=b'9' => true,
    _ => false,
}matches!(*self, b'0'..=b'9') | #[allow(non_exhaustive_omitted_patterns)] match *self {
    b'A'..=b'F' => true,
    _ => false,
}matches!(*self, b'A'..=b'F') | #[allow(non_exhaustive_omitted_patterns)] match *self {
    b'a'..=b'f' => true,
    _ => false,
}matches!(*self, b'a'..=b'f')
987    }
988
989    /// Checks if the value is an ASCII punctuation character:
990    ///
991    /// - U+0021 ..= U+002F `! " # $ % & ' ( ) * + , - . /`, or
992    /// - U+003A ..= U+0040 `: ; < = > ? @`, or
993    /// - U+005B ..= U+0060 `` [ \ ] ^ _ ` ``, or
994    /// - U+007B ..= U+007E `{ | } ~`
995    ///
996    /// # Examples
997    ///
998    /// ```
999    /// let uppercase_a = b'A';
1000    /// let uppercase_g = b'G';
1001    /// let a = b'a';
1002    /// let g = b'g';
1003    /// let zero = b'0';
1004    /// let percent = b'%';
1005    /// let space = b' ';
1006    /// let lf = b'\n';
1007    /// let esc = b'\x1b';
1008    ///
1009    /// assert!(!uppercase_a.is_ascii_punctuation());
1010    /// assert!(!uppercase_g.is_ascii_punctuation());
1011    /// assert!(!a.is_ascii_punctuation());
1012    /// assert!(!g.is_ascii_punctuation());
1013    /// assert!(!zero.is_ascii_punctuation());
1014    /// assert!(percent.is_ascii_punctuation());
1015    /// assert!(!space.is_ascii_punctuation());
1016    /// assert!(!lf.is_ascii_punctuation());
1017    /// assert!(!esc.is_ascii_punctuation());
1018    /// ```
1019    #[must_use]
1020    #[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
1021    #[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
1022    #[inline]
1023    pub const fn is_ascii_punctuation(&self) -> bool {
1024        #[allow(non_exhaustive_omitted_patterns)] match *self {
    b'!'..=b'/' => true,
    _ => false,
}matches!(*self, b'!'..=b'/')
1025            | #[allow(non_exhaustive_omitted_patterns)] match *self {
    b':'..=b'@' => true,
    _ => false,
}matches!(*self, b':'..=b'@')
1026            | #[allow(non_exhaustive_omitted_patterns)] match *self {
    b'['..=b'`' => true,
    _ => false,
}matches!(*self, b'['..=b'`')
1027            | #[allow(non_exhaustive_omitted_patterns)] match *self {
    b'{'..=b'~' => true,
    _ => false,
}matches!(*self, b'{'..=b'~')
1028    }
1029
1030    /// Checks if the value is an ASCII graphic character:
1031    /// U+0021 '!' ..= U+007E '~'.
1032    ///
1033    /// # Examples
1034    ///
1035    /// ```
1036    /// let uppercase_a = b'A';
1037    /// let uppercase_g = b'G';
1038    /// let a = b'a';
1039    /// let g = b'g';
1040    /// let zero = b'0';
1041    /// let percent = b'%';
1042    /// let space = b' ';
1043    /// let lf = b'\n';
1044    /// let esc = b'\x1b';
1045    ///
1046    /// assert!(uppercase_a.is_ascii_graphic());
1047    /// assert!(uppercase_g.is_ascii_graphic());
1048    /// assert!(a.is_ascii_graphic());
1049    /// assert!(g.is_ascii_graphic());
1050    /// assert!(zero.is_ascii_graphic());
1051    /// assert!(percent.is_ascii_graphic());
1052    /// assert!(!space.is_ascii_graphic());
1053    /// assert!(!lf.is_ascii_graphic());
1054    /// assert!(!esc.is_ascii_graphic());
1055    /// ```
1056    #[must_use]
1057    #[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
1058    #[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
1059    #[inline]
1060    pub const fn is_ascii_graphic(&self) -> bool {
1061        #[allow(non_exhaustive_omitted_patterns)] match *self {
    b'!'..=b'~' => true,
    _ => false,
}matches!(*self, b'!'..=b'~')
1062    }
1063
1064    /// Checks if the value is an ASCII whitespace character:
1065    /// U+0020 SPACE, U+0009 HORIZONTAL TAB, U+000A LINE FEED,
1066    /// U+000C FORM FEED, or U+000D CARRIAGE RETURN.
1067    ///
1068    /// Rust uses the WhatWG Infra Standard's [definition of ASCII
1069    /// whitespace][infra-aw]. There are several other definitions in
1070    /// wide use. For instance, [the POSIX locale][pct] includes
1071    /// U+000B VERTICAL TAB as well as all the above characters,
1072    /// but—from the very same specification—[the default rule for
1073    /// "field splitting" in the Bourne shell][bfs] considers *only*
1074    /// SPACE, HORIZONTAL TAB, and LINE FEED as whitespace.
1075    ///
1076    /// If you are writing a program that will process an existing
1077    /// file format, check what that format's definition of whitespace is
1078    /// before using this function.
1079    ///
1080    /// [infra-aw]: https://infra.spec.whatwg.org/#ascii-whitespace
1081    /// [pct]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_01
1082    /// [bfs]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_05
1083    ///
1084    /// # Examples
1085    ///
1086    /// ```
1087    /// let uppercase_a = b'A';
1088    /// let uppercase_g = b'G';
1089    /// let a = b'a';
1090    /// let g = b'g';
1091    /// let zero = b'0';
1092    /// let percent = b'%';
1093    /// let space = b' ';
1094    /// let lf = b'\n';
1095    /// let esc = b'\x1b';
1096    ///
1097    /// assert!(!uppercase_a.is_ascii_whitespace());
1098    /// assert!(!uppercase_g.is_ascii_whitespace());
1099    /// assert!(!a.is_ascii_whitespace());
1100    /// assert!(!g.is_ascii_whitespace());
1101    /// assert!(!zero.is_ascii_whitespace());
1102    /// assert!(!percent.is_ascii_whitespace());
1103    /// assert!(space.is_ascii_whitespace());
1104    /// assert!(lf.is_ascii_whitespace());
1105    /// assert!(!esc.is_ascii_whitespace());
1106    /// ```
1107    #[must_use]
1108    #[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
1109    #[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
1110    #[inline]
1111    pub const fn is_ascii_whitespace(&self) -> bool {
1112        #[allow(non_exhaustive_omitted_patterns)] match *self {
    b'\t' | b'\n' | b'\x0C' | b'\r' | b' ' => true,
    _ => false,
}matches!(*self, b'\t' | b'\n' | b'\x0C' | b'\r' | b' ')
1113    }
1114
1115    /// Checks if the value is an ASCII control character:
1116    /// U+0000 NUL ..= U+001F UNIT SEPARATOR, or U+007F DELETE.
1117    /// Note that most ASCII whitespace characters are control
1118    /// characters, but SPACE is not.
1119    ///
1120    /// # Examples
1121    ///
1122    /// ```
1123    /// let uppercase_a = b'A';
1124    /// let uppercase_g = b'G';
1125    /// let a = b'a';
1126    /// let g = b'g';
1127    /// let zero = b'0';
1128    /// let percent = b'%';
1129    /// let space = b' ';
1130    /// let lf = b'\n';
1131    /// let esc = b'\x1b';
1132    ///
1133    /// assert!(!uppercase_a.is_ascii_control());
1134    /// assert!(!uppercase_g.is_ascii_control());
1135    /// assert!(!a.is_ascii_control());
1136    /// assert!(!g.is_ascii_control());
1137    /// assert!(!zero.is_ascii_control());
1138    /// assert!(!percent.is_ascii_control());
1139    /// assert!(!space.is_ascii_control());
1140    /// assert!(lf.is_ascii_control());
1141    /// assert!(esc.is_ascii_control());
1142    /// ```
1143    #[must_use]
1144    #[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
1145    #[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.47.0")]
1146    #[inline]
1147    pub const fn is_ascii_control(&self) -> bool {
1148        #[allow(non_exhaustive_omitted_patterns)] match *self {
    b'\0'..=b'\x1F' | b'\x7F' => true,
    _ => false,
}matches!(*self, b'\0'..=b'\x1F' | b'\x7F')
1149    }
1150
1151    /// Returns an iterator that produces an escaped version of a `u8`,
1152    /// treating it as an ASCII character.
1153    ///
1154    /// The behavior is identical to [`ascii::escape_default`].
1155    ///
1156    /// # Examples
1157    ///
1158    /// ```
1159    /// assert_eq!("0", b'0'.escape_ascii().to_string());
1160    /// assert_eq!("\\t", b'\t'.escape_ascii().to_string());
1161    /// assert_eq!("\\r", b'\r'.escape_ascii().to_string());
1162    /// assert_eq!("\\n", b'\n'.escape_ascii().to_string());
1163    /// assert_eq!("\\'", b'\''.escape_ascii().to_string());
1164    /// assert_eq!("\\\"", b'"'.escape_ascii().to_string());
1165    /// assert_eq!("\\\\", b'\\'.escape_ascii().to_string());
1166    /// assert_eq!("\\x9d", b'\x9d'.escape_ascii().to_string());
1167    /// ```
1168    #[must_use = "this returns the escaped byte as an iterator, \
1169                  without modifying the original"]
1170    #[stable(feature = "inherent_ascii_escape", since = "1.60.0")]
1171    #[inline]
1172    pub fn escape_ascii(self) -> ascii::EscapeDefault {
1173        ascii::escape_default(self)
1174    }
1175
1176    #[inline]
1177    pub(crate) const fn is_utf8_char_boundary(self) -> bool {
1178        // This is bit magic equivalent to: b < 128 || b >= 192
1179        (self as i8) >= -0x40
1180    }
1181}
1182
1183impl u16 {
1184    "assert_eq!(u16::MIN, 0);"
Self
0
"(2<sup>16</sup> &minus; 1)."
"assert_eq!(u16::MAX, 65535);"
Self
!0
"assert_eq!(u16::BITS, 16);"
u32
Self::MAX.count_ones()
"let n = 0b01001100u16;"
"let max = u16::MAX;"
"assert_eq!(max.count_ones(), 16);"
"let zero = 0u16;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
return intrinsics::ctpop(self);
"let zero = 0u16;"
"assert_eq!(zero.count_zeros(), 16);"
"let max = u16::MAX;"
"assert_eq!(u16::count_zeros(small), 15);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(!self).count_ones();
"let n = u16::MAX >> 2;"
"let zero = 0u16;"
"assert_eq!(zero.leading_zeros(), 16);"
"let max = u16::MAX;"
"[`ilog2`]: u16::ilog2"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
return intrinsics::ctlz(self as u16);
"let n = 0b0101000u16;"
"let zero = 0u16;"
"assert_eq!(zero.trailing_zeros(), 16);"
"let max = u16::MAX;"
"assert_eq!(max.trailing_zeros(), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
return intrinsics::cttz(self);
"let n = !(u16::MAX >> 2);"
"let zero = 0u16;"
"let max = u16::MAX;"
"assert_eq!(max.leading_ones(), 16);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(!self).leading_zeros();
"let n = 0b1010111u16;"
"let zero = 0u16;"
"let max = u16::MAX;"
"assert_eq!(max.trailing_ones(), 16);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(!self).trailing_zeros();
"assert_eq!(0_u16.bit_width(), 0);"
"assert_eq!(0b111_u16.bit_width(), 3);"
"assert_eq!(0b1110_u16.bit_width(), 4);"
"assert_eq!(u16::MAX.bit_width(), 16);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
Self::BITS - self.leading_zeros();
"let n: u16 = 0b_01100100;"
"assert_eq!(0_u16.isolate_highest_one(), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
self & (((1 as u16) << (<u16>::BITS - 1)).wrapping_shr(self.leading_zeros()));
"let n: u16 = 0b_01100100;"
"assert_eq!(0_u16.isolate_lowest_one(), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
self & self.wrapping_neg();
"assert_eq!(0b0_u16.highest_one(), None);"
"assert_eq!(0b1_u16.highest_one(), Some(0));"
"assert_eq!(0b1_0000_u16.highest_one(), Some(4));"
"assert_eq!(0b1_1111_u16.highest_one(), Some(4));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
match NonZero::new(self) { Some(v) => Some(v.highest_one()), None => None, }
"assert_eq!(0b0_u16.lowest_one(), None);"
"assert_eq!(0b1_u16.lowest_one(), Some(0));"
"assert_eq!(0b1_0000_u16.lowest_one(), Some(4));"
"assert_eq!(0b1_1111_u16.lowest_one(), Some(0));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
match NonZero::new(self) { Some(v) => Some(v.lowest_one()), None => None, }
"let n = u16::MAX;"
"assert_eq!(n.cast_signed(), -1i16);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i16
self as i16;
"let n = 0xa003u16;"
"let m = 0x3a;"
"assert_eq!(n.rotate_left(4), m);"
"assert_eq!(n.rotate_left(1024), n);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
n
Self
return intrinsics::rotate_left(self, n);
"let n = 0x3au16;"
"let m = 0xa003;"
"assert_eq!(n.rotate_right(4), m);"
"assert_eq!(n.rotate_right(1024), n);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
n
Self
return intrinsics::rotate_right(self, n);
"let a = 0xa003u16;"
"let b = 0x2deu16;"
"let m = 0x30;"
"assert_eq!(a.funnel_shl(b, 4), m);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
u32
n
Self
if !(n < Self::BITS) {
    {
        crate::panicking::panic_fmt(format_args!("attempt to funnel shift left with overflow"));
    }
};
unsafe { self.unchecked_funnel_shl(rhs, n) }
"let a = 0xa003u16;"
"let b = 0x2deu16;"
"let m = 0x302d;"
"assert_eq!(a.funnel_shr(b, 4), m);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
u32
n
Self
if !(n < Self::BITS) {
    {
        crate::panicking::panic_fmt(format_args!("attempt to funnel shift right with overflow"));
    }
};
unsafe { self.unchecked_funnel_shr(rhs, n) }
"`u16::BITS`,"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
low
u32
n
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(n: u32) {
        if !(n < <u16>::BITS) {
            let msg =
                "unsafe precondition(s) violated: u16::unchecked_funnel_shl cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(n); }
};
unsafe { intrinsics::unchecked_funnel_shl(self, low, n) }
"`u16::BITS`,"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
low
u32
n
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(n: u32) {
        if !(n < <u16>::BITS) {
            let msg =
                "unsafe precondition(s) violated: u16::unchecked_funnel_shr cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(n); }
};
unsafe { intrinsics::unchecked_funnel_shr(self, low, n) }
"pub fn carryless_mul(lhs: u16, rhs: u16) -> u16{"
"    for i in 0..u16::BITS {"
"let a = 0x9012u16;"
"let b = 0xcd34u16;"
"assert_eq!(a.carryless_mul(b), 0x928);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::carryless_mul(self, rhs);
"let n = 0x1234u16;"
"assert_eq!(m, 0x3412);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
intrinsics::bswap(self as u16) as Self;
"let n: u16 = 0b1011_1100;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
mask
Self
imp::int_bits::u16::extract_impl(self as u16, mask as u16) as u16;
"let n: u16 = 0b1010_1101;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
mask
Self
imp::int_bits::u16::deposit_impl(self as u16, mask as u16) as u16;
"let n = 0x1234u16;"
"assert_eq!(m, 0x2c48);"
"assert_eq!(0, 0u16.reverse_bits());"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
intrinsics::bitreverse(self as u16) as Self;
"let n = 0x1Au16;"
"    assert_eq!(u16::from_be(n), n)"
"    assert_eq!(u16::from_be(n), n.swap_bytes())"
Self
x
Self
{ x.swap_bytes() }
"let n = 0x1Au16;"
"    assert_eq!(u16::from_le(n), n)"
"    assert_eq!(u16::from_le(n), n.swap_bytes())"
Self
x
Self
{ x }
"let n = 0x1Au16;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
{ self.swap_bytes() }
"let n = 0x1Au16;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
{ self }
"assert_eq!((u16::MAX - 2).checked_add(1), Some(u16::MAX - 1));"
"assert_eq!((u16::MAX - 2).checked_add(3), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(intrinsics::add_with_overflow(self, rhs).1) {
    None
} else { Some(unsafe { intrinsics::unchecked_add(self, rhs) }) }
"assert_eq!((u16::MAX - 2).strict_add(1), u16::MAX - 1);"
"let _ = (u16::MAX - 2).strict_add(3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_add(rhs);
if b { imp::overflow_panic::add() } else { a }
"`self + rhs > u16::MAX` or `self + rhs < u16::MIN`,"
"[`checked_add`]: u16::checked_add"
"[`wrapping_add`]: u16::wrapping_add"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: u16, rhs: u16) {
        if !!lhs.overflowing_add(rhs).1 {
            let msg =
                "unsafe precondition(s) violated: u16::unchecked_add cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::unchecked_add(self, rhs) }
"assert_eq!(1u16.checked_add_signed(2), Some(3));"
"assert_eq!(1u16.checked_add_signed(-2), None);"
"assert_eq!((u16::MAX - 2).checked_add_signed(3), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i16
rhs
Option<Self>
let (a, b) = self.overflowing_add_signed(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!(1u16.strict_add_signed(2), 3);"
"let _ = 1u16.strict_add_signed(-2);"
"let _ = (u16::MAX - 2).strict_add_signed(3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i16
rhs
Self
let (a, b) = self.overflowing_add_signed(rhs);
if b { imp::overflow_panic::add() } else { a }
"assert_eq!(1u16.checked_sub(1), Some(0));"
"assert_eq!(0u16.checked_sub(1), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if self < rhs {
    None
} else { Some(unsafe { intrinsics::unchecked_sub(self, rhs) }) }
"assert_eq!(1u16.strict_sub(1), 0);"
"let _ = 0u16.strict_sub(1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_sub(rhs);
if b { imp::overflow_panic::sub() } else { a }
"`self - rhs > u16::MAX` or `self - rhs < u16::MIN`,"
"[`checked_sub`]: u16::checked_sub"
"[`wrapping_sub`]: u16::wrapping_sub"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: u16, rhs: u16) {
        if !!lhs.overflowing_sub(rhs).1 {
            let msg =
                "unsafe precondition(s) violated: u16::unchecked_sub cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::unchecked_sub(self, rhs) }
"assert_eq!(1u16.checked_sub_signed(2), None);"
"assert_eq!(1u16.checked_sub_signed(-2), Some(3));"
"assert_eq!((u16::MAX - 2).checked_sub_signed(-4), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i16
rhs
Option<Self>
let (res, overflow) = self.overflowing_sub_signed(rhs);
if !overflow { Some(res) } else { None }
"assert_eq!(3u16.strict_sub_signed(2), 1);"
"let _ = 1u16.strict_sub_signed(2);"
"let _ = (u16::MAX).strict_sub_signed(-1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i16
rhs
Self
let (a, b) = self.overflowing_sub_signed(rhs);
if b { imp::overflow_panic::sub() } else { a }
"Checked integer subtraction. Computes `self - rhs` and checks if the result fits into an [`i16`], returning `None` if overflow occurred."
"assert_eq!(10u16.checked_signed_diff(2), Some(8));"
"assert_eq!(2u16.checked_signed_diff(10), Some(-8));"
"assert_eq!(u16::MAX.checked_signed_diff(i16::MAX as u16), None);"
"assert_eq!((i16::MAX as u16).checked_signed_diff(u16::MAX), Some(i16::MIN));"
"assert_eq!((i16::MAX as u16 + 1).checked_signed_diff(0), None);"
"assert_eq!(u16::MAX.checked_signed_diff(u16::MAX), Some(0));"
Self
self
Self
rhs
Option<i16>
let res = self.wrapping_sub(rhs) as i16;
let overflow = (self >= rhs) == (res < 0);
if !overflow { Some(res) } else { None }
"assert_eq!(5u16.checked_mul(1), Some(5));"
"assert_eq!(u16::MAX.checked_mul(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
let (a, b) = self.overflowing_mul(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!(5u16.strict_mul(1), 5);"
"let _ = u16::MAX.strict_mul(2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_mul(rhs);
if b { imp::overflow_panic::mul() } else { a }
"`self * rhs > u16::MAX` or `self * rhs < u16::MIN`,"
"[`checked_mul`]: u16::checked_mul"
"[`wrapping_mul`]: u16::wrapping_mul"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: u16, rhs: u16) {
        if !!lhs.overflowing_mul(rhs).1 {
            let msg =
                "unsafe precondition(s) violated: u16::unchecked_mul cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::unchecked_mul(self, rhs) }
"assert_eq!(128u16.checked_div(2), Some(64));"
"assert_eq!(1u16.checked_div(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0) {
    None
} else { Some(unsafe { intrinsics::unchecked_div(self, rhs) }) }
"assert_eq!(100u16.strict_div(10), 10);"
"let _ = (1u16).strict_div(0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self / rhs;
"assert_eq!(128u16.checked_div_euclid(2), Some(64));"
"assert_eq!(1u16.checked_div_euclid(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0) { None } else { Some(self.div_euclid(rhs)) }
"assert_eq!(100u16.strict_div_euclid(10), 10);"
"let _ = (1u16).strict_div_euclid(0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self / rhs;
"assert_eq!(64u16.checked_div_exact(2), Some(32));"
"assert_eq!(64u16.checked_div_exact(32), Some(2));"
"assert_eq!(64u16.checked_div_exact(0), None);"
"assert_eq!(65u16.checked_div_exact(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0) {
    None
} else {
    unsafe {
        if intrinsics::unlikely(intrinsics::unchecked_rem(self, rhs) != 0) {
            None
        } else { Some(intrinsics::exact_div(self, rhs)) }
    }
}
"assert_eq!(64u16.div_exact(2), Some(32));"
"assert_eq!(64u16.div_exact(32), Some(2));"
"assert_eq!(65u16.div_exact(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if self % rhs != 0 { None } else { Some(self / rhs) }
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: u16, rhs: u16) {
        if !(rhs > 0 && lhs % rhs == 0) {
            let msg =
                "unsafe precondition(s) violated: u16::unchecked_div_exact divide by zero or leave a remainder\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::exact_div(self, rhs) }
"assert_eq!(5u16.checked_rem(2), Some(1));"
"assert_eq!(5u16.checked_rem(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0) {
    None
} else { Some(unsafe { intrinsics::unchecked_rem(self, rhs) }) }
"assert_eq!(100u16.strict_rem(10), 0);"
"let _ = 5u16.strict_rem(0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self % rhs;
"assert_eq!(5u16.checked_rem_euclid(2), Some(1));"
"assert_eq!(5u16.checked_rem_euclid(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0) { None } else { Some(self.rem_euclid(rhs)) }
"assert_eq!(100u16.strict_rem_euclid(10), 0);"
"let _ = 5u16.strict_rem_euclid(0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self % rhs;
"    assert_eq!(1_u16.unchecked_disjoint_bitor(4), 5);"
Self
self
Self
other
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: u16, rhs: u16) {
        if !((lhs & rhs) == 0) {
            let msg =
                "unsafe precondition(s) violated: u16::unchecked_disjoint_bitor cannot have overlapping bits\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, other);
    }
};
unsafe { intrinsics::disjoint_bitor(self, other) }
"assert_eq!(5u16.ilog(5), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
base
u32
if !(base >= 2) {
    {
        crate::panicking::panic_fmt(format_args!("base of integer logarithm must be at least 2"));
    }
};
if let Some(log) = self.checked_ilog(base) {
    log
} else { imp::int_log10::panic_for_nonpositive_argument() }
"assert_eq!(2u16.ilog2(), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
if let Some(log) = self.checked_ilog2() {
    log
} else { imp::int_log10::panic_for_nonpositive_argument() }
"assert_eq!(10u16.ilog10(), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
if let Some(log) = self.checked_ilog10() {
    log
} else { imp::int_log10::panic_for_nonpositive_argument() }
"assert_eq!(5u16.checked_ilog(5), Some(1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
base
Option<u32>
if core::intrinsics::is_val_statically_known(base) {
    if base == 2 {
        return self.checked_ilog2();
    } else if base == 10 { return self.checked_ilog10(); }
}
if self <= 0 || base <= 1 {
    None
} else if self < base {
    Some(0)
} else {
    let mut n = 1;
    let mut r = base;
    if Self::BITS == 128 {
        n = self.ilog2() / (base.ilog2() + 1);
        r = base.pow(n);
    }
    while r <= self / base { n += 1; r *= base; }
    Some(n)
}
"assert_eq!(2u16.checked_ilog2(), Some(1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
match NonZero::new(self) { Some(x) => Some(x.ilog2()), None => None, }
"assert_eq!(10u16.checked_ilog10(), Some(1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
match NonZero::new(self) { Some(x) => Some(x.ilog10()), None => None, }
"assert_eq!(0u16.checked_neg(), Some(0));"
"assert_eq!(1u16.checked_neg(), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<Self>
let (a, b) = self.overflowing_neg();
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!(0u16.strict_neg(), 0);"
"let _ = 1u16.strict_neg();"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
let (a, b) = self.overflowing_neg();
if b { imp::overflow_panic::neg() } else { a }
"assert_eq!(0x1u16.checked_shl(4), Some(0x10));"
"assert_eq!(0x10u16.checked_shl(129), None);"
"assert_eq!(0x10u16.checked_shl(15), Some(0));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<Self>
if rhs < Self::BITS { Some(unsafe { self.unchecked_shl(rhs) }) } else { None }
"assert_eq!(0x1u16.strict_shl(4), 0x10);"
"let _ = 0x10u16.strict_shl(129);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
let (a, b) = self.overflowing_shl(rhs);
if b { imp::overflow_panic::shl() } else { a }
"[`checked_shl`]: u16::checked_shl"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(rhs: u32) {
        if !(rhs < <u16>::BITS) {
            let msg =
                "unsafe precondition(s) violated: u16::unchecked_shl cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(rhs); }
};
unsafe { intrinsics::unchecked_shl(self, rhs) }
"assert_eq!(0x1_u16.unbounded_shl(4), 0x10);"
"assert_eq!(0x1_u16.unbounded_shl(129), 0);"
"assert_eq!(0b101_u16.unbounded_shl(0), 0b101);"
"assert_eq!(0b101_u16.unbounded_shl(1), 0b1010);"
"assert_eq!(0b101_u16.unbounded_shl(2), 0b10100);"
"assert_eq!(42_u16.unbounded_shl(16), 0);"
"assert_eq!(42_u16.unbounded_shl(1).unbounded_shl(15), 0);"
"let start : u16 = 13;"
"    assert_eq!(running == start.wrapping_shl(i), i < 16);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
if rhs < Self::BITS { unsafe { self.unchecked_shl(rhs) } } else { 0 }
"`u16::BITS`."
"assert_eq!(0x1u16.shl_exact(4), Some(0x10));"
"assert_eq!(0x1u16.shl_exact(129), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<u16>
if rhs <= self.leading_zeros() && rhs < <u16>::BITS {
    Some(unsafe { self.unchecked_shl(rhs) })
} else { None }
"`u16::BITS`."
"u16::BITS`"
"[`u16::shl_exact`]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(zeros: u32, bits: u32, rhs: u32) {
        if !(rhs <= zeros && rhs < bits) {
            let msg =
                "unsafe precondition(s) violated: u16::unchecked_shl_exact cannot shift out non-zero bits\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_library_ub() {
        precondition_check(self.leading_zeros(), <u16>::BITS, rhs);
    }
};
unsafe { self.unchecked_shl(rhs) }
"assert_eq!(0x10u16.checked_shr(4), Some(0x1));"
"assert_eq!(0x10u16.checked_shr(129), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<Self>
if rhs < Self::BITS { Some(unsafe { self.unchecked_shr(rhs) }) } else { None }
"assert_eq!(0x10u16.strict_shr(4), 0x1);"
"let _ = 0x10u16.strict_shr(129);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
let (a, b) = self.overflowing_shr(rhs);
if b { imp::overflow_panic::shr() } else { a }
"[`checked_shr`]: u16::checked_shr"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(rhs: u32) {
        if !(rhs < <u16>::BITS) {
            let msg =
                "unsafe precondition(s) violated: u16::unchecked_shr cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(rhs); }
};
unsafe { intrinsics::unchecked_shr(self, rhs) }
"assert_eq!(0x10_u16.unbounded_shr(4), 0x1);"
"assert_eq!(0x10_u16.unbounded_shr(129), 0);"
"assert_eq!(0b1010_u16.unbounded_shr(0), 0b1010);"
"assert_eq!(0b1010_u16.unbounded_shr(1), 0b101);"
"assert_eq!(0b1010_u16.unbounded_shr(2), 0b10);"
"assert_eq!(42_u16.unbounded_shr(16), 0);"
"assert_eq!(42_u16.unbounded_shr(1).unbounded_shr(15), 0);"
"let start = u16::rotate_right(13, 4);"
"    assert_eq!(running == start.wrapping_shr(i), i < 16);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
if rhs < Self::BITS { unsafe { self.unchecked_shr(rhs) } } else { 0 }
"`u16::BITS`."
"assert_eq!(0x10u16.shr_exact(4), Some(0x1));"
"assert_eq!(0x10u16.shr_exact(5), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<u16>
if rhs <= self.trailing_zeros() && rhs < <u16>::BITS {
    Some(unsafe { self.unchecked_shr(rhs) })
} else { None }
"`u16::BITS`."
"u16::BITS`"
"[`u16::shr_exact`]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(zeros: u32, bits: u32, rhs: u32) {
        if !(rhs <= zeros && rhs < bits) {
            let msg =
                "unsafe precondition(s) violated: u16::unchecked_shr_exact cannot shift out non-zero bits\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_library_ub() {
        precondition_check(self.trailing_zeros(), <u16>::BITS, rhs);
    }
};
unsafe { self.unchecked_shr(rhs) }
"assert_eq!(2u16.checked_pow(5), Some(32));"
"assert_eq!(0_u16.checked_pow(0), Some(1));"
"assert_eq!(u16::MAX.checked_pow(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Option<Self>
if exp == 0 { return Some(1); }
let mut base = self;
let mut acc: Self = 1;
loop {
    if (exp & 1) == 1 {
        acc =
            match acc.checked_mul(base) {
                Some(x) => x,
                None => return None,
            };
        if exp == 1 { return Some(acc); }
    }
    exp /= 2;
    base =
        match base.checked_mul(base) { Some(x) => x, None => return None, };
}
"assert_eq!(2u16.strict_pow(5), 32);"
"assert_eq!(0_u16.strict_pow(0), 1);"
"let _ = u16::MAX.strict_pow(2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Self
if exp == 0 { return 1; }
let mut base = self;
let mut acc: Self = 1;
loop {
    if (exp & 1) == 1 {
        acc = acc.strict_mul(base);
        if exp == 1 { return acc; }
    }
    exp /= 2;
    base = base.strict_mul(base);
}
"assert_eq!(100u16.saturating_add(1), 101);"
"assert_eq!(u16::MAX.saturating_add(127), u16::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::saturating_add(self, rhs);
"assert_eq!(1u16.saturating_add_signed(2), 3);"
"assert_eq!(1u16.saturating_add_signed(-2), 0);"
"assert_eq!((u16::MAX - 2).saturating_add_signed(4), u16::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i16
rhs
Self
let (res, overflow) = self.overflowing_add(rhs as Self);
if overflow == (rhs < 0) { res } else if overflow { Self::MAX } else { 0 }
"assert_eq!(100u16.saturating_sub(27), 73);"
"assert_eq!(13u16.saturating_sub(127), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::saturating_sub(self, rhs);
"assert_eq!(1u16.saturating_sub_signed(2), 0);"
"assert_eq!(1u16.saturating_sub_signed(-2), 3);"
"assert_eq!((u16::MAX - 2).saturating_sub_signed(-4), u16::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i16
rhs
Self
let (res, overflow) = self.overflowing_sub_signed(rhs);
if !overflow { res } else if rhs < 0 { Self::MAX } else { 0 }
"assert_eq!(2u16.saturating_mul(10), 20);"
"assert_eq!((u16::MAX).saturating_mul(10), u16::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
match self.checked_mul(rhs) { Some(x) => x, None => Self::MAX, }
"assert_eq!(5u16.saturating_div(2), 2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self.wrapping_div(rhs);
"assert_eq!(4u16.saturating_pow(3), 64);"
"assert_eq!(0_u16.saturating_pow(0), 1);"
"assert_eq!(u16::MAX.saturating_pow(2), u16::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
exp
Self
match self.checked_pow(exp) { Some(x) => x, None => Self::MAX, }
"assert_eq!(200u16.wrapping_add(55), 255);"
"assert_eq!(200u16.wrapping_add(u16::MAX), 199);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::wrapping_add(self, rhs);
"assert_eq!(1u16.wrapping_add_signed(2), 3);"
"assert_eq!(1u16.wrapping_add_signed(-2), u16::MAX);"
"assert_eq!((u16::MAX - 2).wrapping_add_signed(4), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i16
rhs
Self
self.wrapping_add(rhs as Self);
"assert_eq!(100u16.wrapping_sub(100), 0);"
"assert_eq!(100u16.wrapping_sub(u16::MAX), 101);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::wrapping_sub(self, rhs);
"assert_eq!(1u16.wrapping_sub_signed(2), u16::MAX);"
"assert_eq!(1u16.wrapping_sub_signed(-2), 3);"
"assert_eq!((u16::MAX - 2).wrapping_sub_signed(-4), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i16
rhs
Self
self.wrapping_sub(rhs as Self);
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::wrapping_mul(self, rhs);
"assert_eq!(100u16.wrapping_div(10), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self / rhs;
"assert_eq!(100u16.wrapping_div_euclid(10), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self / rhs;
"assert_eq!(100u16.wrapping_rem(10), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self % rhs;
"assert_eq!(100u16.wrapping_rem_euclid(10), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self % rhs;
"assert_eq!(0_u16.wrapping_neg(), 0);"
"assert_eq!(u16::MAX.wrapping_neg(), 1);"
"assert_eq!(13_u16.wrapping_neg(), (!13) + 1);"
"assert_eq!(42_u16.wrapping_neg(), !(42 - 1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
(0 as u16).wrapping_sub(self);
"assert_eq!(1_u16.wrapping_shl(7), 128);"
"assert_eq!(0b101_u16.wrapping_shl(0), 0b101);"
"assert_eq!(0b101_u16.wrapping_shl(1), 0b1010);"
"assert_eq!(0b101_u16.wrapping_shl(2), 0b10100);"
"assert_eq!(u16::MAX.wrapping_shl(2), u16::MAX - 3);"
"assert_eq!(42_u16.wrapping_shl(16), 42);"
"assert_eq!(42_u16.wrapping_shl(1).wrapping_shl(15), 0);"
"assert_eq!(1_u16.wrapping_shl(128), 1);"
"assert_eq!(5_u16.wrapping_shl(1025), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
unsafe { self.unchecked_shl(rhs & (Self::BITS - 1)) }
"assert_eq!(128_u16.wrapping_shr(7), 1);"
"assert_eq!(0b1010_u16.wrapping_shr(0), 0b1010);"
"assert_eq!(0b1010_u16.wrapping_shr(1), 0b101);"
"assert_eq!(0b1010_u16.wrapping_shr(2), 0b10);"
"assert_eq!(u16::MAX.wrapping_shr(1), i16::MAX.cast_unsigned());"
"assert_eq!(42_u16.wrapping_shr(16), 42);"
"assert_eq!(42_u16.wrapping_shr(1).wrapping_shr(15), 0);"
"assert_eq!(128_u16.wrapping_shr(128), 128);"
"assert_eq!(10_u16.wrapping_shr(1025), 5);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
unsafe { self.unchecked_shr(rhs & (Self::BITS - 1)) }
"assert_eq!(3u16.wrapping_pow(5), 243);"
"assert_eq!(0_u16.wrapping_pow(0), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Self
if exp == 0 { return 1; }
let mut base = self;
let mut acc: Self = 1;
if intrinsics::is_val_statically_known(exp) {
    while exp > 1 {
        if (exp & 1) == 1 { acc = acc.wrapping_mul(base); }
        exp /= 2;
        base = base.wrapping_mul(base);
    }
    acc.wrapping_mul(base)
} else {
    loop {
        if (exp & 1) == 1 {
            acc = acc.wrapping_mul(base);
            if exp == 1 { return acc; }
        }
        exp /= 2;
        base = base.wrapping_mul(base);
    }
}
"assert_eq!(5u16.overflowing_add(2), (7, false));"
"assert_eq!(u16::MAX.overflowing_add(1), (0, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
let (a, b) = intrinsics::add_with_overflow(self as u16, rhs as u16);
(a as Self, b);
"This can be thought of as a 16-bit \"full adder\", in the electronics sense."
"//    3  MAX    (a = 3 \u{d7} 2^16 + 2^16 - 1)"
"// +  5    7    (b = 5 \u{d7} 2^16 + 7)"
"//    9    6    (sum = 9 \u{d7} 2^16 + 6)"
"let (a1, a0): (u16, u16) = (3, u16::MAX);"
"let (b1, b0): (u16, u16) = (5, 7);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
bool
carry
(Self, bool)
let (a, c1) = self.overflowing_add(rhs);
let (b, c2) = a.overflowing_add(carry as u16);
(b, unsafe { intrinsics::disjoint_bitor(c1, c2) });
"assert_eq!(1u16.overflowing_add_signed(2), (3, false));"
"assert_eq!(1u16.overflowing_add_signed(-2), (u16::MAX, true));"
"assert_eq!((u16::MAX - 2).overflowing_add_signed(4), (1, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i16
rhs
(Self, bool)
let (res, overflowed) = self.overflowing_add(rhs as Self);
(res, overflowed ^ (rhs < 0));
"assert_eq!(5u16.overflowing_sub(2), (3, false));"
"assert_eq!(0u16.overflowing_sub(1), (u16::MAX, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
let (a, b) = intrinsics::sub_with_overflow(self as u16, rhs as u16);
(a as Self, b);
"//    9    6    (a = 9 \u{d7} 2^16 + 6)"
"// -  5    7    (b = 5 \u{d7} 2^16 + 7)"
"//    3  MAX    (diff = 3 \u{d7} 2^16 + 2^16 - 1)"
"let (a1, a0): (u16, u16) = (9, 6);"
"let (b1, b0): (u16, u16) = (5, 7);"
"assert_eq!((diff1, diff0), (3, u16::MAX));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
bool
borrow
(Self, bool)
let (a, c1) = self.overflowing_sub(rhs);
let (b, c2) = a.overflowing_sub(borrow as u16);
(b, unsafe { intrinsics::disjoint_bitor(c1, c2) });
"assert_eq!(1u16.overflowing_sub_signed(2), (u16::MAX, true));"
"assert_eq!(1u16.overflowing_sub_signed(-2), (3, false));"
"assert_eq!((u16::MAX - 2).overflowing_sub_signed(-4), (1, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i16
rhs
(Self, bool)
let (res, overflow) = self.overflowing_sub(rhs as Self);
(res, overflow ^ (rhs < 0));
"assert_eq!(100u16.abs_diff(80), 20u16);"
"assert_eq!(100u16.abs_diff(110), 10u16);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
other
Self
if size_of::<Self>() == 1 {
    (self as i32).wrapping_sub(other as i32).unsigned_abs() as Self
} else { if self < other { other - self } else { self - other } }
"this returns the result of the operation, \
                          without modifying the original"
Self
self
Self
rhs
(Self, bool)
let (a, b) = intrinsics::mul_with_overflow(self as u16, rhs as u16);
(a as Self, b);
"assert_eq!(5_u16.widening_mul(7), (35, 0));"
"assert_eq!(u16::MAX.widening_mul(u16::MAX), (1, u16::MAX - 1));"
"assert_eq!(u16::widening_mul(1 << 15, 6), (0, 3));"
"assert_eq!(u16::overflowing_mul(1 << 15, 6), (0, true));"
"assert_eq!(u16::wrapping_mul(1 << 15, 6), 0);"
"assert_eq!(u16::checked_mul(1 << 15, 6), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, Self)
Self::carrying_mul_add(self, rhs, 0, 0);
"assert_eq!(u16::MAX.carrying_mul(u16::MAX, u16::MAX), (0, u16::MAX));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
carry
(Self, Self)
Self::carrying_mul_add(self, rhs, carry, 0);
"assert_eq!(u16::MAX.carrying_mul_add(u16::MAX, u16::MAX, u16::MAX), (u16::MAX, u16::MAX));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
carry
Self
add
(Self, Self)
intrinsics::carrying_mul_add(self, rhs, carry, add);
"assert_eq!(5u16.overflowing_div(2), (2, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
(self / rhs, false);
"assert_eq!(5u16.overflowing_div_euclid(2), (2, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
(self / rhs, false);
"assert_eq!(5u16.overflowing_rem(2), (1, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
(self % rhs, false);
"assert_eq!(5u16.overflowing_rem_euclid(2), (1, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
(self % rhs, false);
"assert_eq!(0u16.overflowing_neg(), (0, false));"
"assert_eq!(2u16.overflowing_neg(), (-2i32 as u16, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
(Self, bool)
((!self).wrapping_add(1), self != 0);
"assert_eq!(0x1u16.overflowing_shl(4), (0x10, false));"
"assert_eq!(0x1u16.overflowing_shl(132), (0x10, true));"
"assert_eq!(0x10u16.overflowing_shl(15), (0, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
(Self, bool)
(self.wrapping_shl(rhs), rhs >= Self::BITS);
"assert_eq!(0x10u16.overflowing_shr(4), (0x1, false));"
"assert_eq!(0x10u16.overflowing_shr(132), (0x1, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
(Self, bool)
(self.wrapping_shr(rhs), rhs >= Self::BITS);
"assert_eq!(3u16.overflowing_pow(5), (243, false));"
"assert_eq!(0_u16.overflowing_pow(0), (1, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
(Self, bool)
if exp == 0 { return (1, false); }
let mut base = self;
let mut acc: Self = 1;
let mut overflown = false;
let mut r;
loop {
    if (exp & 1) == 1 {
        r = acc.overflowing_mul(base);
        if exp == 1 { r.1 |= overflown; return r; }
        acc = r.0;
        overflown |= r.1;
    }
    exp /= 2;
    r = base.overflowing_mul(base);
    base = r.0;
    overflown |= r.1;
}
"assert_eq!(2u16.pow(5), 32);"
"assert_eq!(0_u16.pow(0), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Self
if exp == 0 { return 1; }
let mut base = self;
let mut acc = 1;
if intrinsics::is_val_statically_known(exp) {
    while exp > 1 {
        if (exp & 1) == 1 { acc = acc * base; }
        exp /= 2;
        base = base * base;
    }
    acc * base
} else {
    loop {
        if (exp & 1) == 1 { acc = acc * base; if exp == 1 { return acc; } }
        exp /= 2;
        base = base * base;
    }
}
"assert_eq!(10u16.isqrt(), 3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
let result = imp::int_sqrt::u16(self as u16) as u16;
unsafe {
    const MAX_RESULT: u16 = imp::int_sqrt::u16(<u16>::MAX) as u16;
    crate::hint::assert_unchecked(result <= MAX_RESULT);
}
result;
"assert_eq!(7u16.div_euclid(4), 1); // or any other integer type"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self / rhs;
"assert_eq!(7u16.rem_euclid(4), 3); // or any other integer type"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self % rhs;
"assert_eq!(7_u16.div_floor(4), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self / rhs;
"assert_eq!(7_u16.div_ceil(4), 2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let d = self / rhs;
let r = self % rhs;
if r > 0 { d + 1 } else { d }
"assert_eq!(16_u16.next_multiple_of(8), 16);"
"assert_eq!(23_u16.next_multiple_of(8), 24);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
match self % rhs { 0 => self, r => self + (rhs - r), }
"assert_eq!(16_u16.checked_next_multiple_of(8), Some(16));"
"assert_eq!(23_u16.checked_next_multiple_of(8), Some(24));"
"assert_eq!(1_u16.checked_next_multiple_of(0), None);"
"assert_eq!(u16::MAX.checked_next_multiple_of(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
match match self.checked_rem(rhs) { Some(x) => x, None => return None, } {
    0 => Some(self),
    r => self.checked_add(rhs - r),
}
"assert!(6_u16.is_multiple_of(2));"
"assert!(!5_u16.is_multiple_of(2));"
"assert!(0_u16.is_multiple_of(0));"
"assert!(!6_u16.is_multiple_of(0));"
Self
self
Self
rhs
bool
match rhs { 0 => self == 0, _ => self % rhs == 0, }
"assert!(16u16.is_power_of_two());"
"assert!(!10u16.is_power_of_two());"
Self
self
bool
self.count_ones() == 1;
Self
self
Self
if self <= 1 { return 0; }
let p = self - 1;
let z = unsafe { intrinsics::ctlz_nonzero(p) };
<u16>::MAX >> z;
"assert_eq!(2u16.next_power_of_two(), 2);"
"assert_eq!(3u16.next_power_of_two(), 4);"
"assert_eq!(0u16.next_power_of_two(), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
self.one_less_than_next_power_of_two() + 1;
"assert_eq!(2u16.checked_next_power_of_two(), Some(2));"
"assert_eq!(3u16.checked_next_power_of_two(), Some(4));"
"assert_eq!(u16::MAX.checked_next_power_of_two(), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<Self>
self.one_less_than_next_power_of_two().checked_add(1);
"assert_eq!(2u16.wrapping_next_power_of_two(), 2);"
"assert_eq!(3u16.wrapping_next_power_of_two(), 4);"
"assert_eq!(u16::MAX.wrapping_next_power_of_two(), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
self.one_less_than_next_power_of_two().wrapping_add(1);
"let bytes = 0x1234u16.to_be_bytes();"
"assert_eq!(bytes, [0x12, 0x34]);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
self.to_be().to_ne_bytes();
"let bytes = 0x1234u16.to_le_bytes();"
"assert_eq!(bytes, [0x34, 0x12]);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
self.to_le().to_ne_bytes();
"let bytes = 0x1234u16.to_ne_bytes();"
"        [0x12, 0x34]"
"        [0x34, 0x12]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
unsafe { mem::transmute(self) }
"let value = u16::from_be_bytes([0x12, 0x34]);"
"assert_eq!(value, 0x1234);"
"fn read_be_u16(input: &mut &[u8]) -> u16 {"
"    let (int_bytes, rest) = input.split_at(size_of::<u16>());"
"    u16::from_be_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
Self::from_be(Self::from_ne_bytes(bytes));
"let value = u16::from_le_bytes([0x34, 0x12]);"
"assert_eq!(value, 0x1234);"
"fn read_le_u16(input: &mut &[u8]) -> u16 {"
"    let (int_bytes, rest) = input.split_at(size_of::<u16>());"
"    u16::from_le_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
Self::from_le(Self::from_ne_bytes(bytes));
"let value = u16::from_ne_bytes(if cfg!(target_endian = \"big\") {"
"    [0x12, 0x34]"
"    [0x34, 0x12]"
"assert_eq!(value, 0x1234);"
"fn read_ne_u16(input: &mut &[u8]) -> u16 {"
"    let (int_bytes, rest) = input.split_at(size_of::<u16>());"
"    u16::from_ne_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
unsafe { mem::transmute(bytes) }
"[`u16::MIN`] instead."
"u16_legacy_fn_min_value"
Self
Self::MIN;
"[`u16::MAX`] instead."
"u16_legacy_fn_max_value"
Self
Self::MAX;
"assert_eq!(120u8, 120u16.truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Target
traits::TruncateTarget::internal_truncate(self);
"assert_eq!(120u8, 120u16.saturating_truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Target
traits::TruncateTarget::internal_saturating_truncate(self);
"assert_eq!(Some(120u8), 120u16.checked_truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Option<Target>
traits::TruncateTarget::internal_checked_truncate(self);
"assert_eq!(120u128, 120u8.extend());"
"this returns the extended value and does not modify the original"
Self
Target
Self
self
Target
traits::ExtendTarget::internal_extend(self);uint_impl! {
1185        Self = u16,
1186        ActualT = u16,
1187        SignedT = i16,
1188        BITS = 16,
1189        BITS_MINUS_ONE = 15,
1190        MAX = 65535,
1191        rot = 4,
1192        rot_op = "0xa003",
1193        rot_result = "0x3a",
1194        fsh_op = "0x2de",
1195        fshl_result = "0x30",
1196        fshr_result = "0x302d",
1197        clmul_lhs = "0x9012",
1198        clmul_rhs = "0xcd34",
1199        clmul_result = "0x928",
1200        swap_op = "0x1234",
1201        swapped = "0x3412",
1202        reversed = "0x2c48",
1203        le_bytes = "[0x34, 0x12]",
1204        be_bytes = "[0x12, 0x34]",
1205        to_xe_bytes_doc = "",
1206        from_xe_bytes_doc = "",
1207        bound_condition = "",
1208    }
1209    "assert_eq!(0u16.midpoint(4), 2);"
"assert_eq!(1u16.midpoint(4), 2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
((self as u32 + rhs as u32) / 2) as u16;midpoint_impl! { u16, u32, unsigned }
1210    "assert_eq!(u16::MAX.widening_carryless_mul(u16::MAX), u32::MAX / 3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
(self as u32).carryless_mul(rhs as u32);widening_carryless_mul_impl! { u16, u32 }
1211    self
Self
rhs
Self
carry
(Self, Self)
let p = (self as u32).carryless_mul(rhs as u32);
let lo = (p as u16);
let hi = (p >> Self::BITS) as u16;
(lo ^ carry, hi);carrying_carryless_mul_impl! { u16, u32 }
1212
1213    /// Checks if the value is a Unicode surrogate code point, which are disallowed values for [`char`].
1214    ///
1215    /// # Examples
1216    ///
1217    /// ```
1218    /// #![feature(utf16_extra)]
1219    ///
1220    /// let low_non_surrogate = 0xA000u16;
1221    /// let low_surrogate = 0xD800u16;
1222    /// let high_surrogate = 0xDC00u16;
1223    /// let high_non_surrogate = 0xE000u16;
1224    ///
1225    /// assert!(!low_non_surrogate.is_utf16_surrogate());
1226    /// assert!(low_surrogate.is_utf16_surrogate());
1227    /// assert!(high_surrogate.is_utf16_surrogate());
1228    /// assert!(!high_non_surrogate.is_utf16_surrogate());
1229    /// ```
1230    #[must_use]
1231    #[unstable(feature = "utf16_extra", issue = "94919")]
1232    #[inline]
1233    pub const fn is_utf16_surrogate(self) -> bool {
1234        #[allow(non_exhaustive_omitted_patterns)] match self {
    0xD800..=0xDFFF => true,
    _ => false,
}matches!(self, 0xD800..=0xDFFF)
1235    }
1236}
1237
1238impl u32 {
1239    "assert_eq!(u32::MIN, 0);"
Self
0
"(2<sup>32</sup> &minus; 1)."
"assert_eq!(u32::MAX, 4294967295);"
Self
!0
"assert_eq!(u32::BITS, 32);"
u32
Self::MAX.count_ones()
"let n = 0b01001100u32;"
"let max = u32::MAX;"
"assert_eq!(max.count_ones(), 32);"
"let zero = 0u32;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
return intrinsics::ctpop(self);
"let zero = 0u32;"
"assert_eq!(zero.count_zeros(), 32);"
"let max = u32::MAX;"
"assert_eq!(u32::count_zeros(small), 31);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(!self).count_ones();
"let n = u32::MAX >> 2;"
"let zero = 0u32;"
"assert_eq!(zero.leading_zeros(), 32);"
"let max = u32::MAX;"
"[`ilog2`]: u32::ilog2"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
return intrinsics::ctlz(self as u32);
"let n = 0b0101000u32;"
"let zero = 0u32;"
"assert_eq!(zero.trailing_zeros(), 32);"
"let max = u32::MAX;"
"assert_eq!(max.trailing_zeros(), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
return intrinsics::cttz(self);
"let n = !(u32::MAX >> 2);"
"let zero = 0u32;"
"let max = u32::MAX;"
"assert_eq!(max.leading_ones(), 32);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(!self).leading_zeros();
"let n = 0b1010111u32;"
"let zero = 0u32;"
"let max = u32::MAX;"
"assert_eq!(max.trailing_ones(), 32);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(!self).trailing_zeros();
"assert_eq!(0_u32.bit_width(), 0);"
"assert_eq!(0b111_u32.bit_width(), 3);"
"assert_eq!(0b1110_u32.bit_width(), 4);"
"assert_eq!(u32::MAX.bit_width(), 32);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
Self::BITS - self.leading_zeros();
"let n: u32 = 0b_01100100;"
"assert_eq!(0_u32.isolate_highest_one(), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
self & (((1 as u32) << (<u32>::BITS - 1)).wrapping_shr(self.leading_zeros()));
"let n: u32 = 0b_01100100;"
"assert_eq!(0_u32.isolate_lowest_one(), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
self & self.wrapping_neg();
"assert_eq!(0b0_u32.highest_one(), None);"
"assert_eq!(0b1_u32.highest_one(), Some(0));"
"assert_eq!(0b1_0000_u32.highest_one(), Some(4));"
"assert_eq!(0b1_1111_u32.highest_one(), Some(4));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
match NonZero::new(self) { Some(v) => Some(v.highest_one()), None => None, }
"assert_eq!(0b0_u32.lowest_one(), None);"
"assert_eq!(0b1_u32.lowest_one(), Some(0));"
"assert_eq!(0b1_0000_u32.lowest_one(), Some(4));"
"assert_eq!(0b1_1111_u32.lowest_one(), Some(0));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
match NonZero::new(self) { Some(v) => Some(v.lowest_one()), None => None, }
"let n = u32::MAX;"
"assert_eq!(n.cast_signed(), -1i32);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i32
self as i32;
"let n = 0x10000b3u32;"
"let m = 0xb301;"
"assert_eq!(n.rotate_left(8), m);"
"assert_eq!(n.rotate_left(1024), n);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
n
Self
return intrinsics::rotate_left(self, n);
"let n = 0xb301u32;"
"let m = 0x10000b3;"
"assert_eq!(n.rotate_right(8), m);"
"assert_eq!(n.rotate_right(1024), n);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
n
Self
return intrinsics::rotate_right(self, n);
"let a = 0x10000b3u32;"
"let b = 0x2fe78e45u32;"
"let m = 0xb32f;"
"assert_eq!(a.funnel_shl(b, 8), m);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
u32
n
Self
if !(n < Self::BITS) {
    {
        crate::panicking::panic_fmt(format_args!("attempt to funnel shift left with overflow"));
    }
};
unsafe { self.unchecked_funnel_shl(rhs, n) }
"let a = 0x10000b3u32;"
"let b = 0x2fe78e45u32;"
"let m = 0xb32fe78e;"
"assert_eq!(a.funnel_shr(b, 8), m);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
u32
n
Self
if !(n < Self::BITS) {
    {
        crate::panicking::panic_fmt(format_args!("attempt to funnel shift right with overflow"));
    }
};
unsafe { self.unchecked_funnel_shr(rhs, n) }
"`u32::BITS`,"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
low
u32
n
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(n: u32) {
        if !(n < <u32>::BITS) {
            let msg =
                "unsafe precondition(s) violated: u32::unchecked_funnel_shl cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(n); }
};
unsafe { intrinsics::unchecked_funnel_shl(self, low, n) }
"`u32::BITS`,"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
low
u32
n
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(n: u32) {
        if !(n < <u32>::BITS) {
            let msg =
                "unsafe precondition(s) violated: u32::unchecked_funnel_shr cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(n); }
};
unsafe { intrinsics::unchecked_funnel_shr(self, low, n) }
"pub fn carryless_mul(lhs: u32, rhs: u32) -> u32{"
"    for i in 0..u32::BITS {"
"let a = 0x56789012u32;"
"let b = 0xf52ecd34u32;"
"assert_eq!(a.carryless_mul(b), 0x9b980928);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::carryless_mul(self, rhs);
"let n = 0x12345678u32;"
"assert_eq!(m, 0x78563412);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
intrinsics::bswap(self as u32) as Self;
"let n: u32 = 0b1011_1100;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
mask
Self
imp::int_bits::u32::extract_impl(self as u32, mask as u32) as u32;
"let n: u32 = 0b1010_1101;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
mask
Self
imp::int_bits::u32::deposit_impl(self as u32, mask as u32) as u32;
"let n = 0x12345678u32;"
"assert_eq!(m, 0x1e6a2c48);"
"assert_eq!(0, 0u32.reverse_bits());"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
intrinsics::bitreverse(self as u32) as Self;
"let n = 0x1Au32;"
"    assert_eq!(u32::from_be(n), n)"
"    assert_eq!(u32::from_be(n), n.swap_bytes())"
Self
x
Self
{ x.swap_bytes() }
"let n = 0x1Au32;"
"    assert_eq!(u32::from_le(n), n)"
"    assert_eq!(u32::from_le(n), n.swap_bytes())"
Self
x
Self
{ x }
"let n = 0x1Au32;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
{ self.swap_bytes() }
"let n = 0x1Au32;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
{ self }
"assert_eq!((u32::MAX - 2).checked_add(1), Some(u32::MAX - 1));"
"assert_eq!((u32::MAX - 2).checked_add(3), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(intrinsics::add_with_overflow(self, rhs).1) {
    None
} else { Some(unsafe { intrinsics::unchecked_add(self, rhs) }) }
"assert_eq!((u32::MAX - 2).strict_add(1), u32::MAX - 1);"
"let _ = (u32::MAX - 2).strict_add(3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_add(rhs);
if b { imp::overflow_panic::add() } else { a }
"`self + rhs > u32::MAX` or `self + rhs < u32::MIN`,"
"[`checked_add`]: u32::checked_add"
"[`wrapping_add`]: u32::wrapping_add"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: u32, rhs: u32) {
        if !!lhs.overflowing_add(rhs).1 {
            let msg =
                "unsafe precondition(s) violated: u32::unchecked_add cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::unchecked_add(self, rhs) }
"assert_eq!(1u32.checked_add_signed(2), Some(3));"
"assert_eq!(1u32.checked_add_signed(-2), None);"
"assert_eq!((u32::MAX - 2).checked_add_signed(3), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i32
rhs
Option<Self>
let (a, b) = self.overflowing_add_signed(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!(1u32.strict_add_signed(2), 3);"
"let _ = 1u32.strict_add_signed(-2);"
"let _ = (u32::MAX - 2).strict_add_signed(3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i32
rhs
Self
let (a, b) = self.overflowing_add_signed(rhs);
if b { imp::overflow_panic::add() } else { a }
"assert_eq!(1u32.checked_sub(1), Some(0));"
"assert_eq!(0u32.checked_sub(1), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if self < rhs {
    None
} else { Some(unsafe { intrinsics::unchecked_sub(self, rhs) }) }
"assert_eq!(1u32.strict_sub(1), 0);"
"let _ = 0u32.strict_sub(1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_sub(rhs);
if b { imp::overflow_panic::sub() } else { a }
"`self - rhs > u32::MAX` or `self - rhs < u32::MIN`,"
"[`checked_sub`]: u32::checked_sub"
"[`wrapping_sub`]: u32::wrapping_sub"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: u32, rhs: u32) {
        if !!lhs.overflowing_sub(rhs).1 {
            let msg =
                "unsafe precondition(s) violated: u32::unchecked_sub cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::unchecked_sub(self, rhs) }
"assert_eq!(1u32.checked_sub_signed(2), None);"
"assert_eq!(1u32.checked_sub_signed(-2), Some(3));"
"assert_eq!((u32::MAX - 2).checked_sub_signed(-4), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i32
rhs
Option<Self>
let (res, overflow) = self.overflowing_sub_signed(rhs);
if !overflow { Some(res) } else { None }
"assert_eq!(3u32.strict_sub_signed(2), 1);"
"let _ = 1u32.strict_sub_signed(2);"
"let _ = (u32::MAX).strict_sub_signed(-1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i32
rhs
Self
let (a, b) = self.overflowing_sub_signed(rhs);
if b { imp::overflow_panic::sub() } else { a }
"Checked integer subtraction. Computes `self - rhs` and checks if the result fits into an [`i32`], returning `None` if overflow occurred."
"assert_eq!(10u32.checked_signed_diff(2), Some(8));"
"assert_eq!(2u32.checked_signed_diff(10), Some(-8));"
"assert_eq!(u32::MAX.checked_signed_diff(i32::MAX as u32), None);"
"assert_eq!((i32::MAX as u32).checked_signed_diff(u32::MAX), Some(i32::MIN));"
"assert_eq!((i32::MAX as u32 + 1).checked_signed_diff(0), None);"
"assert_eq!(u32::MAX.checked_signed_diff(u32::MAX), Some(0));"
Self
self
Self
rhs
Option<i32>
let res = self.wrapping_sub(rhs) as i32;
let overflow = (self >= rhs) == (res < 0);
if !overflow { Some(res) } else { None }
"assert_eq!(5u32.checked_mul(1), Some(5));"
"assert_eq!(u32::MAX.checked_mul(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
let (a, b) = self.overflowing_mul(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!(5u32.strict_mul(1), 5);"
"let _ = u32::MAX.strict_mul(2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_mul(rhs);
if b { imp::overflow_panic::mul() } else { a }
"`self * rhs > u32::MAX` or `self * rhs < u32::MIN`,"
"[`checked_mul`]: u32::checked_mul"
"[`wrapping_mul`]: u32::wrapping_mul"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: u32, rhs: u32) {
        if !!lhs.overflowing_mul(rhs).1 {
            let msg =
                "unsafe precondition(s) violated: u32::unchecked_mul cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::unchecked_mul(self, rhs) }
"assert_eq!(128u32.checked_div(2), Some(64));"
"assert_eq!(1u32.checked_div(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0) {
    None
} else { Some(unsafe { intrinsics::unchecked_div(self, rhs) }) }
"assert_eq!(100u32.strict_div(10), 10);"
"let _ = (1u32).strict_div(0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self / rhs;
"assert_eq!(128u32.checked_div_euclid(2), Some(64));"
"assert_eq!(1u32.checked_div_euclid(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0) { None } else { Some(self.div_euclid(rhs)) }
"assert_eq!(100u32.strict_div_euclid(10), 10);"
"let _ = (1u32).strict_div_euclid(0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self / rhs;
"assert_eq!(64u32.checked_div_exact(2), Some(32));"
"assert_eq!(64u32.checked_div_exact(32), Some(2));"
"assert_eq!(64u32.checked_div_exact(0), None);"
"assert_eq!(65u32.checked_div_exact(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0) {
    None
} else {
    unsafe {
        if intrinsics::unlikely(intrinsics::unchecked_rem(self, rhs) != 0) {
            None
        } else { Some(intrinsics::exact_div(self, rhs)) }
    }
}
"assert_eq!(64u32.div_exact(2), Some(32));"
"assert_eq!(64u32.div_exact(32), Some(2));"
"assert_eq!(65u32.div_exact(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if self % rhs != 0 { None } else { Some(self / rhs) }
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: u32, rhs: u32) {
        if !(rhs > 0 && lhs % rhs == 0) {
            let msg =
                "unsafe precondition(s) violated: u32::unchecked_div_exact divide by zero or leave a remainder\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::exact_div(self, rhs) }
"assert_eq!(5u32.checked_rem(2), Some(1));"
"assert_eq!(5u32.checked_rem(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0) {
    None
} else { Some(unsafe { intrinsics::unchecked_rem(self, rhs) }) }
"assert_eq!(100u32.strict_rem(10), 0);"
"let _ = 5u32.strict_rem(0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self % rhs;
"assert_eq!(5u32.checked_rem_euclid(2), Some(1));"
"assert_eq!(5u32.checked_rem_euclid(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0) { None } else { Some(self.rem_euclid(rhs)) }
"assert_eq!(100u32.strict_rem_euclid(10), 0);"
"let _ = 5u32.strict_rem_euclid(0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self % rhs;
"    assert_eq!(1_u32.unchecked_disjoint_bitor(4), 5);"
Self
self
Self
other
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: u32, rhs: u32) {
        if !((lhs & rhs) == 0) {
            let msg =
                "unsafe precondition(s) violated: u32::unchecked_disjoint_bitor cannot have overlapping bits\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, other);
    }
};
unsafe { intrinsics::disjoint_bitor(self, other) }
"assert_eq!(5u32.ilog(5), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
base
u32
if !(base >= 2) {
    {
        crate::panicking::panic_fmt(format_args!("base of integer logarithm must be at least 2"));
    }
};
if let Some(log) = self.checked_ilog(base) {
    log
} else { imp::int_log10::panic_for_nonpositive_argument() }
"assert_eq!(2u32.ilog2(), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
if let Some(log) = self.checked_ilog2() {
    log
} else { imp::int_log10::panic_for_nonpositive_argument() }
"assert_eq!(10u32.ilog10(), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
if let Some(log) = self.checked_ilog10() {
    log
} else { imp::int_log10::panic_for_nonpositive_argument() }
"assert_eq!(5u32.checked_ilog(5), Some(1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
base
Option<u32>
if core::intrinsics::is_val_statically_known(base) {
    if base == 2 {
        return self.checked_ilog2();
    } else if base == 10 { return self.checked_ilog10(); }
}
if self <= 0 || base <= 1 {
    None
} else if self < base {
    Some(0)
} else {
    let mut n = 1;
    let mut r = base;
    if Self::BITS == 128 {
        n = self.ilog2() / (base.ilog2() + 1);
        r = base.pow(n);
    }
    while r <= self / base { n += 1; r *= base; }
    Some(n)
}
"assert_eq!(2u32.checked_ilog2(), Some(1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
match NonZero::new(self) { Some(x) => Some(x.ilog2()), None => None, }
"assert_eq!(10u32.checked_ilog10(), Some(1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
match NonZero::new(self) { Some(x) => Some(x.ilog10()), None => None, }
"assert_eq!(0u32.checked_neg(), Some(0));"
"assert_eq!(1u32.checked_neg(), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<Self>
let (a, b) = self.overflowing_neg();
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!(0u32.strict_neg(), 0);"
"let _ = 1u32.strict_neg();"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
let (a, b) = self.overflowing_neg();
if b { imp::overflow_panic::neg() } else { a }
"assert_eq!(0x1u32.checked_shl(4), Some(0x10));"
"assert_eq!(0x10u32.checked_shl(129), None);"
"assert_eq!(0x10u32.checked_shl(31), Some(0));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<Self>
if rhs < Self::BITS { Some(unsafe { self.unchecked_shl(rhs) }) } else { None }
"assert_eq!(0x1u32.strict_shl(4), 0x10);"
"let _ = 0x10u32.strict_shl(129);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
let (a, b) = self.overflowing_shl(rhs);
if b { imp::overflow_panic::shl() } else { a }
"[`checked_shl`]: u32::checked_shl"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(rhs: u32) {
        if !(rhs < <u32>::BITS) {
            let msg =
                "unsafe precondition(s) violated: u32::unchecked_shl cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(rhs); }
};
unsafe { intrinsics::unchecked_shl(self, rhs) }
"assert_eq!(0x1_u32.unbounded_shl(4), 0x10);"
"assert_eq!(0x1_u32.unbounded_shl(129), 0);"
"assert_eq!(0b101_u32.unbounded_shl(0), 0b101);"
"assert_eq!(0b101_u32.unbounded_shl(1), 0b1010);"
"assert_eq!(0b101_u32.unbounded_shl(2), 0b10100);"
"assert_eq!(42_u32.unbounded_shl(32), 0);"
"assert_eq!(42_u32.unbounded_shl(1).unbounded_shl(31), 0);"
"let start : u32 = 13;"
"    assert_eq!(running == start.wrapping_shl(i), i < 32);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
if rhs < Self::BITS { unsafe { self.unchecked_shl(rhs) } } else { 0 }
"`u32::BITS`."
"assert_eq!(0x1u32.shl_exact(4), Some(0x10));"
"assert_eq!(0x1u32.shl_exact(129), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<u32>
if rhs <= self.leading_zeros() && rhs < <u32>::BITS {
    Some(unsafe { self.unchecked_shl(rhs) })
} else { None }
"`u32::BITS`."
"u32::BITS`"
"[`u32::shl_exact`]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(zeros: u32, bits: u32, rhs: u32) {
        if !(rhs <= zeros && rhs < bits) {
            let msg =
                "unsafe precondition(s) violated: u32::unchecked_shl_exact cannot shift out non-zero bits\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_library_ub() {
        precondition_check(self.leading_zeros(), <u32>::BITS, rhs);
    }
};
unsafe { self.unchecked_shl(rhs) }
"assert_eq!(0x10u32.checked_shr(4), Some(0x1));"
"assert_eq!(0x10u32.checked_shr(129), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<Self>
if rhs < Self::BITS { Some(unsafe { self.unchecked_shr(rhs) }) } else { None }
"assert_eq!(0x10u32.strict_shr(4), 0x1);"
"let _ = 0x10u32.strict_shr(129);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
let (a, b) = self.overflowing_shr(rhs);
if b { imp::overflow_panic::shr() } else { a }
"[`checked_shr`]: u32::checked_shr"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(rhs: u32) {
        if !(rhs < <u32>::BITS) {
            let msg =
                "unsafe precondition(s) violated: u32::unchecked_shr cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(rhs); }
};
unsafe { intrinsics::unchecked_shr(self, rhs) }
"assert_eq!(0x10_u32.unbounded_shr(4), 0x1);"
"assert_eq!(0x10_u32.unbounded_shr(129), 0);"
"assert_eq!(0b1010_u32.unbounded_shr(0), 0b1010);"
"assert_eq!(0b1010_u32.unbounded_shr(1), 0b101);"
"assert_eq!(0b1010_u32.unbounded_shr(2), 0b10);"
"assert_eq!(42_u32.unbounded_shr(32), 0);"
"assert_eq!(42_u32.unbounded_shr(1).unbounded_shr(31), 0);"
"let start = u32::rotate_right(13, 4);"
"    assert_eq!(running == start.wrapping_shr(i), i < 32);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
if rhs < Self::BITS { unsafe { self.unchecked_shr(rhs) } } else { 0 }
"`u32::BITS`."
"assert_eq!(0x10u32.shr_exact(4), Some(0x1));"
"assert_eq!(0x10u32.shr_exact(5), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<u32>
if rhs <= self.trailing_zeros() && rhs < <u32>::BITS {
    Some(unsafe { self.unchecked_shr(rhs) })
} else { None }
"`u32::BITS`."
"u32::BITS`"
"[`u32::shr_exact`]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(zeros: u32, bits: u32, rhs: u32) {
        if !(rhs <= zeros && rhs < bits) {
            let msg =
                "unsafe precondition(s) violated: u32::unchecked_shr_exact cannot shift out non-zero bits\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_library_ub() {
        precondition_check(self.trailing_zeros(), <u32>::BITS, rhs);
    }
};
unsafe { self.unchecked_shr(rhs) }
"assert_eq!(2u32.checked_pow(5), Some(32));"
"assert_eq!(0_u32.checked_pow(0), Some(1));"
"assert_eq!(u32::MAX.checked_pow(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Option<Self>
if exp == 0 { return Some(1); }
let mut base = self;
let mut acc: Self = 1;
loop {
    if (exp & 1) == 1 {
        acc =
            match acc.checked_mul(base) {
                Some(x) => x,
                None => return None,
            };
        if exp == 1 { return Some(acc); }
    }
    exp /= 2;
    base =
        match base.checked_mul(base) { Some(x) => x, None => return None, };
}
"assert_eq!(2u32.strict_pow(5), 32);"
"assert_eq!(0_u32.strict_pow(0), 1);"
"let _ = u32::MAX.strict_pow(2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Self
if exp == 0 { return 1; }
let mut base = self;
let mut acc: Self = 1;
loop {
    if (exp & 1) == 1 {
        acc = acc.strict_mul(base);
        if exp == 1 { return acc; }
    }
    exp /= 2;
    base = base.strict_mul(base);
}
"assert_eq!(100u32.saturating_add(1), 101);"
"assert_eq!(u32::MAX.saturating_add(127), u32::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::saturating_add(self, rhs);
"assert_eq!(1u32.saturating_add_signed(2), 3);"
"assert_eq!(1u32.saturating_add_signed(-2), 0);"
"assert_eq!((u32::MAX - 2).saturating_add_signed(4), u32::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i32
rhs
Self
let (res, overflow) = self.overflowing_add(rhs as Self);
if overflow == (rhs < 0) { res } else if overflow { Self::MAX } else { 0 }
"assert_eq!(100u32.saturating_sub(27), 73);"
"assert_eq!(13u32.saturating_sub(127), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::saturating_sub(self, rhs);
"assert_eq!(1u32.saturating_sub_signed(2), 0);"
"assert_eq!(1u32.saturating_sub_signed(-2), 3);"
"assert_eq!((u32::MAX - 2).saturating_sub_signed(-4), u32::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i32
rhs
Self
let (res, overflow) = self.overflowing_sub_signed(rhs);
if !overflow { res } else if rhs < 0 { Self::MAX } else { 0 }
"assert_eq!(2u32.saturating_mul(10), 20);"
"assert_eq!((u32::MAX).saturating_mul(10), u32::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
match self.checked_mul(rhs) { Some(x) => x, None => Self::MAX, }
"assert_eq!(5u32.saturating_div(2), 2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self.wrapping_div(rhs);
"assert_eq!(4u32.saturating_pow(3), 64);"
"assert_eq!(0_u32.saturating_pow(0), 1);"
"assert_eq!(u32::MAX.saturating_pow(2), u32::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
exp
Self
match self.checked_pow(exp) { Some(x) => x, None => Self::MAX, }
"assert_eq!(200u32.wrapping_add(55), 255);"
"assert_eq!(200u32.wrapping_add(u32::MAX), 199);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::wrapping_add(self, rhs);
"assert_eq!(1u32.wrapping_add_signed(2), 3);"
"assert_eq!(1u32.wrapping_add_signed(-2), u32::MAX);"
"assert_eq!((u32::MAX - 2).wrapping_add_signed(4), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i32
rhs
Self
self.wrapping_add(rhs as Self);
"assert_eq!(100u32.wrapping_sub(100), 0);"
"assert_eq!(100u32.wrapping_sub(u32::MAX), 101);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::wrapping_sub(self, rhs);
"assert_eq!(1u32.wrapping_sub_signed(2), u32::MAX);"
"assert_eq!(1u32.wrapping_sub_signed(-2), 3);"
"assert_eq!((u32::MAX - 2).wrapping_sub_signed(-4), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i32
rhs
Self
self.wrapping_sub(rhs as Self);
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::wrapping_mul(self, rhs);
"assert_eq!(100u32.wrapping_div(10), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self / rhs;
"assert_eq!(100u32.wrapping_div_euclid(10), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self / rhs;
"assert_eq!(100u32.wrapping_rem(10), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self % rhs;
"assert_eq!(100u32.wrapping_rem_euclid(10), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self % rhs;
"assert_eq!(0_u32.wrapping_neg(), 0);"
"assert_eq!(u32::MAX.wrapping_neg(), 1);"
"assert_eq!(13_u32.wrapping_neg(), (!13) + 1);"
"assert_eq!(42_u32.wrapping_neg(), !(42 - 1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
(0 as u32).wrapping_sub(self);
"assert_eq!(1_u32.wrapping_shl(7), 128);"
"assert_eq!(0b101_u32.wrapping_shl(0), 0b101);"
"assert_eq!(0b101_u32.wrapping_shl(1), 0b1010);"
"assert_eq!(0b101_u32.wrapping_shl(2), 0b10100);"
"assert_eq!(u32::MAX.wrapping_shl(2), u32::MAX - 3);"
"assert_eq!(42_u32.wrapping_shl(32), 42);"
"assert_eq!(42_u32.wrapping_shl(1).wrapping_shl(31), 0);"
"assert_eq!(1_u32.wrapping_shl(128), 1);"
"assert_eq!(5_u32.wrapping_shl(1025), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
unsafe { self.unchecked_shl(rhs & (Self::BITS - 1)) }
"assert_eq!(128_u32.wrapping_shr(7), 1);"
"assert_eq!(0b1010_u32.wrapping_shr(0), 0b1010);"
"assert_eq!(0b1010_u32.wrapping_shr(1), 0b101);"
"assert_eq!(0b1010_u32.wrapping_shr(2), 0b10);"
"assert_eq!(u32::MAX.wrapping_shr(1), i32::MAX.cast_unsigned());"
"assert_eq!(42_u32.wrapping_shr(32), 42);"
"assert_eq!(42_u32.wrapping_shr(1).wrapping_shr(31), 0);"
"assert_eq!(128_u32.wrapping_shr(128), 128);"
"assert_eq!(10_u32.wrapping_shr(1025), 5);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
unsafe { self.unchecked_shr(rhs & (Self::BITS - 1)) }
"assert_eq!(3u32.wrapping_pow(5), 243);"
"assert_eq!(0_u32.wrapping_pow(0), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Self
if exp == 0 { return 1; }
let mut base = self;
let mut acc: Self = 1;
if intrinsics::is_val_statically_known(exp) {
    while exp > 1 {
        if (exp & 1) == 1 { acc = acc.wrapping_mul(base); }
        exp /= 2;
        base = base.wrapping_mul(base);
    }
    acc.wrapping_mul(base)
} else {
    loop {
        if (exp & 1) == 1 {
            acc = acc.wrapping_mul(base);
            if exp == 1 { return acc; }
        }
        exp /= 2;
        base = base.wrapping_mul(base);
    }
}
"assert_eq!(5u32.overflowing_add(2), (7, false));"
"assert_eq!(u32::MAX.overflowing_add(1), (0, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
let (a, b) = intrinsics::add_with_overflow(self as u32, rhs as u32);
(a as Self, b);
"This can be thought of as a 32-bit \"full adder\", in the electronics sense."
"//    3  MAX    (a = 3 \u{d7} 2^32 + 2^32 - 1)"
"// +  5    7    (b = 5 \u{d7} 2^32 + 7)"
"//    9    6    (sum = 9 \u{d7} 2^32 + 6)"
"let (a1, a0): (u32, u32) = (3, u32::MAX);"
"let (b1, b0): (u32, u32) = (5, 7);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
bool
carry
(Self, bool)
let (a, c1) = self.overflowing_add(rhs);
let (b, c2) = a.overflowing_add(carry as u32);
(b, unsafe { intrinsics::disjoint_bitor(c1, c2) });
"assert_eq!(1u32.overflowing_add_signed(2), (3, false));"
"assert_eq!(1u32.overflowing_add_signed(-2), (u32::MAX, true));"
"assert_eq!((u32::MAX - 2).overflowing_add_signed(4), (1, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i32
rhs
(Self, bool)
let (res, overflowed) = self.overflowing_add(rhs as Self);
(res, overflowed ^ (rhs < 0));
"assert_eq!(5u32.overflowing_sub(2), (3, false));"
"assert_eq!(0u32.overflowing_sub(1), (u32::MAX, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
let (a, b) = intrinsics::sub_with_overflow(self as u32, rhs as u32);
(a as Self, b);
"//    9    6    (a = 9 \u{d7} 2^32 + 6)"
"// -  5    7    (b = 5 \u{d7} 2^32 + 7)"
"//    3  MAX    (diff = 3 \u{d7} 2^32 + 2^32 - 1)"
"let (a1, a0): (u32, u32) = (9, 6);"
"let (b1, b0): (u32, u32) = (5, 7);"
"assert_eq!((diff1, diff0), (3, u32::MAX));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
bool
borrow
(Self, bool)
let (a, c1) = self.overflowing_sub(rhs);
let (b, c2) = a.overflowing_sub(borrow as u32);
(b, unsafe { intrinsics::disjoint_bitor(c1, c2) });
"assert_eq!(1u32.overflowing_sub_signed(2), (u32::MAX, true));"
"assert_eq!(1u32.overflowing_sub_signed(-2), (3, false));"
"assert_eq!((u32::MAX - 2).overflowing_sub_signed(-4), (1, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i32
rhs
(Self, bool)
let (res, overflow) = self.overflowing_sub(rhs as Self);
(res, overflow ^ (rhs < 0));
"assert_eq!(100u32.abs_diff(80), 20u32);"
"assert_eq!(100u32.abs_diff(110), 10u32);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
other
Self
if size_of::<Self>() == 1 {
    (self as i32).wrapping_sub(other as i32).unsigned_abs() as Self
} else { if self < other { other - self } else { self - other } }
"this returns the result of the operation, \
                          without modifying the original"
Self
self
Self
rhs
(Self, bool)
let (a, b) = intrinsics::mul_with_overflow(self as u32, rhs as u32);
(a as Self, b);
"assert_eq!(5_u32.widening_mul(7), (35, 0));"
"assert_eq!(u32::MAX.widening_mul(u32::MAX), (1, u32::MAX - 1));"
"assert_eq!(u32::widening_mul(1 << 31, 6), (0, 3));"
"assert_eq!(u32::overflowing_mul(1 << 31, 6), (0, true));"
"assert_eq!(u32::wrapping_mul(1 << 31, 6), 0);"
"assert_eq!(u32::checked_mul(1 << 31, 6), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, Self)
Self::carrying_mul_add(self, rhs, 0, 0);
"assert_eq!(u32::MAX.carrying_mul(u32::MAX, u32::MAX), (0, u32::MAX));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
carry
(Self, Self)
Self::carrying_mul_add(self, rhs, carry, 0);
"assert_eq!(u32::MAX.carrying_mul_add(u32::MAX, u32::MAX, u32::MAX), (u32::MAX, u32::MAX));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
carry
Self
add
(Self, Self)
intrinsics::carrying_mul_add(self, rhs, carry, add);
"assert_eq!(5u32.overflowing_div(2), (2, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
(self / rhs, false);
"assert_eq!(5u32.overflowing_div_euclid(2), (2, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
(self / rhs, false);
"assert_eq!(5u32.overflowing_rem(2), (1, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
(self % rhs, false);
"assert_eq!(5u32.overflowing_rem_euclid(2), (1, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
(self % rhs, false);
"assert_eq!(0u32.overflowing_neg(), (0, false));"
"assert_eq!(2u32.overflowing_neg(), (-2i32 as u32, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
(Self, bool)
((!self).wrapping_add(1), self != 0);
"assert_eq!(0x1u32.overflowing_shl(4), (0x10, false));"
"assert_eq!(0x1u32.overflowing_shl(132), (0x10, true));"
"assert_eq!(0x10u32.overflowing_shl(31), (0, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
(Self, bool)
(self.wrapping_shl(rhs), rhs >= Self::BITS);
"assert_eq!(0x10u32.overflowing_shr(4), (0x1, false));"
"assert_eq!(0x10u32.overflowing_shr(132), (0x1, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
(Self, bool)
(self.wrapping_shr(rhs), rhs >= Self::BITS);
"assert_eq!(3u32.overflowing_pow(5), (243, false));"
"assert_eq!(0_u32.overflowing_pow(0), (1, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
(Self, bool)
if exp == 0 { return (1, false); }
let mut base = self;
let mut acc: Self = 1;
let mut overflown = false;
let mut r;
loop {
    if (exp & 1) == 1 {
        r = acc.overflowing_mul(base);
        if exp == 1 { r.1 |= overflown; return r; }
        acc = r.0;
        overflown |= r.1;
    }
    exp /= 2;
    r = base.overflowing_mul(base);
    base = r.0;
    overflown |= r.1;
}
"assert_eq!(2u32.pow(5), 32);"
"assert_eq!(0_u32.pow(0), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Self
if exp == 0 { return 1; }
let mut base = self;
let mut acc = 1;
if intrinsics::is_val_statically_known(exp) {
    while exp > 1 {
        if (exp & 1) == 1 { acc = acc * base; }
        exp /= 2;
        base = base * base;
    }
    acc * base
} else {
    loop {
        if (exp & 1) == 1 { acc = acc * base; if exp == 1 { return acc; } }
        exp /= 2;
        base = base * base;
    }
}
"assert_eq!(10u32.isqrt(), 3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
let result = imp::int_sqrt::u32(self as u32) as u32;
unsafe {
    const MAX_RESULT: u32 = imp::int_sqrt::u32(<u32>::MAX) as u32;
    crate::hint::assert_unchecked(result <= MAX_RESULT);
}
result;
"assert_eq!(7u32.div_euclid(4), 1); // or any other integer type"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self / rhs;
"assert_eq!(7u32.rem_euclid(4), 3); // or any other integer type"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self % rhs;
"assert_eq!(7_u32.div_floor(4), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self / rhs;
"assert_eq!(7_u32.div_ceil(4), 2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let d = self / rhs;
let r = self % rhs;
if r > 0 { d + 1 } else { d }
"assert_eq!(16_u32.next_multiple_of(8), 16);"
"assert_eq!(23_u32.next_multiple_of(8), 24);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
match self % rhs { 0 => self, r => self + (rhs - r), }
"assert_eq!(16_u32.checked_next_multiple_of(8), Some(16));"
"assert_eq!(23_u32.checked_next_multiple_of(8), Some(24));"
"assert_eq!(1_u32.checked_next_multiple_of(0), None);"
"assert_eq!(u32::MAX.checked_next_multiple_of(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
match match self.checked_rem(rhs) { Some(x) => x, None => return None, } {
    0 => Some(self),
    r => self.checked_add(rhs - r),
}
"assert!(6_u32.is_multiple_of(2));"
"assert!(!5_u32.is_multiple_of(2));"
"assert!(0_u32.is_multiple_of(0));"
"assert!(!6_u32.is_multiple_of(0));"
Self
self
Self
rhs
bool
match rhs { 0 => self == 0, _ => self % rhs == 0, }
"assert!(16u32.is_power_of_two());"
"assert!(!10u32.is_power_of_two());"
Self
self
bool
self.count_ones() == 1;
Self
self
Self
if self <= 1 { return 0; }
let p = self - 1;
let z = unsafe { intrinsics::ctlz_nonzero(p) };
<u32>::MAX >> z;
"assert_eq!(2u32.next_power_of_two(), 2);"
"assert_eq!(3u32.next_power_of_two(), 4);"
"assert_eq!(0u32.next_power_of_two(), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
self.one_less_than_next_power_of_two() + 1;
"assert_eq!(2u32.checked_next_power_of_two(), Some(2));"
"assert_eq!(3u32.checked_next_power_of_two(), Some(4));"
"assert_eq!(u32::MAX.checked_next_power_of_two(), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<Self>
self.one_less_than_next_power_of_two().checked_add(1);
"assert_eq!(2u32.wrapping_next_power_of_two(), 2);"
"assert_eq!(3u32.wrapping_next_power_of_two(), 4);"
"assert_eq!(u32::MAX.wrapping_next_power_of_two(), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
self.one_less_than_next_power_of_two().wrapping_add(1);
"let bytes = 0x12345678u32.to_be_bytes();"
"assert_eq!(bytes, [0x12, 0x34, 0x56, 0x78]);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
self.to_be().to_ne_bytes();
"let bytes = 0x12345678u32.to_le_bytes();"
"assert_eq!(bytes, [0x78, 0x56, 0x34, 0x12]);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
self.to_le().to_ne_bytes();
"let bytes = 0x12345678u32.to_ne_bytes();"
"        [0x12, 0x34, 0x56, 0x78]"
"        [0x78, 0x56, 0x34, 0x12]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
unsafe { mem::transmute(self) }
"let value = u32::from_be_bytes([0x12, 0x34, 0x56, 0x78]);"
"assert_eq!(value, 0x12345678);"
"fn read_be_u32(input: &mut &[u8]) -> u32 {"
"    let (int_bytes, rest) = input.split_at(size_of::<u32>());"
"    u32::from_be_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
Self::from_be(Self::from_ne_bytes(bytes));
"let value = u32::from_le_bytes([0x78, 0x56, 0x34, 0x12]);"
"assert_eq!(value, 0x12345678);"
"fn read_le_u32(input: &mut &[u8]) -> u32 {"
"    let (int_bytes, rest) = input.split_at(size_of::<u32>());"
"    u32::from_le_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
Self::from_le(Self::from_ne_bytes(bytes));
"let value = u32::from_ne_bytes(if cfg!(target_endian = \"big\") {"
"    [0x12, 0x34, 0x56, 0x78]"
"    [0x78, 0x56, 0x34, 0x12]"
"assert_eq!(value, 0x12345678);"
"fn read_ne_u32(input: &mut &[u8]) -> u32 {"
"    let (int_bytes, rest) = input.split_at(size_of::<u32>());"
"    u32::from_ne_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
unsafe { mem::transmute(bytes) }
"[`u32::MIN`] instead."
"u32_legacy_fn_min_value"
Self
Self::MIN;
"[`u32::MAX`] instead."
"u32_legacy_fn_max_value"
Self
Self::MAX;
"assert_eq!(120u8, 120u32.truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Target
traits::TruncateTarget::internal_truncate(self);
"assert_eq!(120u8, 120u32.saturating_truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Target
traits::TruncateTarget::internal_saturating_truncate(self);
"assert_eq!(Some(120u8), 120u32.checked_truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Option<Target>
traits::TruncateTarget::internal_checked_truncate(self);
"assert_eq!(120u128, 120u8.extend());"
"this returns the extended value and does not modify the original"
Self
Target
Self
self
Target
traits::ExtendTarget::internal_extend(self);uint_impl! {
1240        Self = u32,
1241        ActualT = u32,
1242        SignedT = i32,
1243        BITS = 32,
1244        BITS_MINUS_ONE = 31,
1245        MAX = 4294967295,
1246        rot = 8,
1247        rot_op = "0x10000b3",
1248        rot_result = "0xb301",
1249        fsh_op = "0x2fe78e45",
1250        fshl_result = "0xb32f",
1251        fshr_result = "0xb32fe78e",
1252        clmul_lhs = "0x56789012",
1253        clmul_rhs = "0xf52ecd34",
1254        clmul_result = "0x9b980928",
1255        swap_op = "0x12345678",
1256        swapped = "0x78563412",
1257        reversed = "0x1e6a2c48",
1258        le_bytes = "[0x78, 0x56, 0x34, 0x12]",
1259        be_bytes = "[0x12, 0x34, 0x56, 0x78]",
1260        to_xe_bytes_doc = "",
1261        from_xe_bytes_doc = "",
1262        bound_condition = "",
1263    }
1264    "assert_eq!(0u32.midpoint(4), 2);"
"assert_eq!(1u32.midpoint(4), 2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
((self as u64 + rhs as u64) / 2) as u32;midpoint_impl! { u32, u64, unsigned }
1265    "assert_eq!(u32::MAX.widening_carryless_mul(u32::MAX), u64::MAX / 3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
(self as u64).carryless_mul(rhs as u64);widening_carryless_mul_impl! { u32, u64 }
1266    self
Self
rhs
Self
carry
(Self, Self)
let p = (self as u64).carryless_mul(rhs as u64);
let lo = (p as u32);
let hi = (p >> Self::BITS) as u32;
(lo ^ carry, hi);carrying_carryless_mul_impl! { u32, u64 }
1267}
1268
1269impl u64 {
1270    "assert_eq!(u64::MIN, 0);"
Self
0
"(2<sup>64</sup> &minus; 1)."
"assert_eq!(u64::MAX, 18446744073709551615);"
Self
!0
"assert_eq!(u64::BITS, 64);"
u32
Self::MAX.count_ones()
"let n = 0b01001100u64;"
"let max = u64::MAX;"
"assert_eq!(max.count_ones(), 64);"
"let zero = 0u64;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
return intrinsics::ctpop(self);
"let zero = 0u64;"
"assert_eq!(zero.count_zeros(), 64);"
"let max = u64::MAX;"
"assert_eq!(u64::count_zeros(small), 63);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(!self).count_ones();
"let n = u64::MAX >> 2;"
"let zero = 0u64;"
"assert_eq!(zero.leading_zeros(), 64);"
"let max = u64::MAX;"
"[`ilog2`]: u64::ilog2"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
return intrinsics::ctlz(self as u64);
"let n = 0b0101000u64;"
"let zero = 0u64;"
"assert_eq!(zero.trailing_zeros(), 64);"
"let max = u64::MAX;"
"assert_eq!(max.trailing_zeros(), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
return intrinsics::cttz(self);
"let n = !(u64::MAX >> 2);"
"let zero = 0u64;"
"let max = u64::MAX;"
"assert_eq!(max.leading_ones(), 64);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(!self).leading_zeros();
"let n = 0b1010111u64;"
"let zero = 0u64;"
"let max = u64::MAX;"
"assert_eq!(max.trailing_ones(), 64);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(!self).trailing_zeros();
"assert_eq!(0_u64.bit_width(), 0);"
"assert_eq!(0b111_u64.bit_width(), 3);"
"assert_eq!(0b1110_u64.bit_width(), 4);"
"assert_eq!(u64::MAX.bit_width(), 64);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
Self::BITS - self.leading_zeros();
"let n: u64 = 0b_01100100;"
"assert_eq!(0_u64.isolate_highest_one(), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
self & (((1 as u64) << (<u64>::BITS - 1)).wrapping_shr(self.leading_zeros()));
"let n: u64 = 0b_01100100;"
"assert_eq!(0_u64.isolate_lowest_one(), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
self & self.wrapping_neg();
"assert_eq!(0b0_u64.highest_one(), None);"
"assert_eq!(0b1_u64.highest_one(), Some(0));"
"assert_eq!(0b1_0000_u64.highest_one(), Some(4));"
"assert_eq!(0b1_1111_u64.highest_one(), Some(4));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
match NonZero::new(self) { Some(v) => Some(v.highest_one()), None => None, }
"assert_eq!(0b0_u64.lowest_one(), None);"
"assert_eq!(0b1_u64.lowest_one(), Some(0));"
"assert_eq!(0b1_0000_u64.lowest_one(), Some(4));"
"assert_eq!(0b1_1111_u64.lowest_one(), Some(0));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
match NonZero::new(self) { Some(v) => Some(v.lowest_one()), None => None, }
"let n = u64::MAX;"
"assert_eq!(n.cast_signed(), -1i64);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i64
self as i64;
"let n = 0xaa00000000006e1u64;"
"let m = 0x6e10aa;"
"assert_eq!(n.rotate_left(12), m);"
"assert_eq!(n.rotate_left(1024), n);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
n
Self
return intrinsics::rotate_left(self, n);
"let n = 0x6e10aau64;"
"let m = 0xaa00000000006e1;"
"assert_eq!(n.rotate_right(12), m);"
"assert_eq!(n.rotate_right(1024), n);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
n
Self
return intrinsics::rotate_right(self, n);
"let a = 0xaa00000000006e1u64;"
"let b = 0x2fe78e45983acd98u64;"
"let m = 0x6e12fe;"
"assert_eq!(a.funnel_shl(b, 12), m);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
u32
n
Self
if !(n < Self::BITS) {
    {
        crate::panicking::panic_fmt(format_args!("attempt to funnel shift left with overflow"));
    }
};
unsafe { self.unchecked_funnel_shl(rhs, n) }
"let a = 0xaa00000000006e1u64;"
"let b = 0x2fe78e45983acd98u64;"
"let m = 0x6e12fe78e45983ac;"
"assert_eq!(a.funnel_shr(b, 12), m);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
u32
n
Self
if !(n < Self::BITS) {
    {
        crate::panicking::panic_fmt(format_args!("attempt to funnel shift right with overflow"));
    }
};
unsafe { self.unchecked_funnel_shr(rhs, n) }
"`u64::BITS`,"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
low
u32
n
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(n: u32) {
        if !(n < <u64>::BITS) {
            let msg =
                "unsafe precondition(s) violated: u64::unchecked_funnel_shl cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(n); }
};
unsafe { intrinsics::unchecked_funnel_shl(self, low, n) }
"`u64::BITS`,"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
low
u32
n
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(n: u32) {
        if !(n < <u64>::BITS) {
            let msg =
                "unsafe precondition(s) violated: u64::unchecked_funnel_shr cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(n); }
};
unsafe { intrinsics::unchecked_funnel_shr(self, low, n) }
"pub fn carryless_mul(lhs: u64, rhs: u64) -> u64{"
"    for i in 0..u64::BITS {"
"let a = 0x7890123456789012u64;"
"let b = 0xdd358416f52ecd34u64;"
"assert_eq!(a.carryless_mul(b), 0xa6299579b980928);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::carryless_mul(self, rhs);
"let n = 0x1234567890123456u64;"
"assert_eq!(m, 0x5634129078563412);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
intrinsics::bswap(self as u64) as Self;
"let n: u64 = 0b1011_1100;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
mask
Self
imp::int_bits::u64::extract_impl(self as u64, mask as u64) as u64;
"let n: u64 = 0b1010_1101;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
mask
Self
imp::int_bits::u64::deposit_impl(self as u64, mask as u64) as u64;
"let n = 0x1234567890123456u64;"
"assert_eq!(m, 0x6a2c48091e6a2c48);"
"assert_eq!(0, 0u64.reverse_bits());"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
intrinsics::bitreverse(self as u64) as Self;
"let n = 0x1Au64;"
"    assert_eq!(u64::from_be(n), n)"
"    assert_eq!(u64::from_be(n), n.swap_bytes())"
Self
x
Self
{ x.swap_bytes() }
"let n = 0x1Au64;"
"    assert_eq!(u64::from_le(n), n)"
"    assert_eq!(u64::from_le(n), n.swap_bytes())"
Self
x
Self
{ x }
"let n = 0x1Au64;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
{ self.swap_bytes() }
"let n = 0x1Au64;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
{ self }
"assert_eq!((u64::MAX - 2).checked_add(1), Some(u64::MAX - 1));"
"assert_eq!((u64::MAX - 2).checked_add(3), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(intrinsics::add_with_overflow(self, rhs).1) {
    None
} else { Some(unsafe { intrinsics::unchecked_add(self, rhs) }) }
"assert_eq!((u64::MAX - 2).strict_add(1), u64::MAX - 1);"
"let _ = (u64::MAX - 2).strict_add(3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_add(rhs);
if b { imp::overflow_panic::add() } else { a }
"`self + rhs > u64::MAX` or `self + rhs < u64::MIN`,"
"[`checked_add`]: u64::checked_add"
"[`wrapping_add`]: u64::wrapping_add"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: u64, rhs: u64) {
        if !!lhs.overflowing_add(rhs).1 {
            let msg =
                "unsafe precondition(s) violated: u64::unchecked_add cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::unchecked_add(self, rhs) }
"assert_eq!(1u64.checked_add_signed(2), Some(3));"
"assert_eq!(1u64.checked_add_signed(-2), None);"
"assert_eq!((u64::MAX - 2).checked_add_signed(3), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i64
rhs
Option<Self>
let (a, b) = self.overflowing_add_signed(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!(1u64.strict_add_signed(2), 3);"
"let _ = 1u64.strict_add_signed(-2);"
"let _ = (u64::MAX - 2).strict_add_signed(3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i64
rhs
Self
let (a, b) = self.overflowing_add_signed(rhs);
if b { imp::overflow_panic::add() } else { a }
"assert_eq!(1u64.checked_sub(1), Some(0));"
"assert_eq!(0u64.checked_sub(1), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if self < rhs {
    None
} else { Some(unsafe { intrinsics::unchecked_sub(self, rhs) }) }
"assert_eq!(1u64.strict_sub(1), 0);"
"let _ = 0u64.strict_sub(1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_sub(rhs);
if b { imp::overflow_panic::sub() } else { a }
"`self - rhs > u64::MAX` or `self - rhs < u64::MIN`,"
"[`checked_sub`]: u64::checked_sub"
"[`wrapping_sub`]: u64::wrapping_sub"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: u64, rhs: u64) {
        if !!lhs.overflowing_sub(rhs).1 {
            let msg =
                "unsafe precondition(s) violated: u64::unchecked_sub cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::unchecked_sub(self, rhs) }
"assert_eq!(1u64.checked_sub_signed(2), None);"
"assert_eq!(1u64.checked_sub_signed(-2), Some(3));"
"assert_eq!((u64::MAX - 2).checked_sub_signed(-4), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i64
rhs
Option<Self>
let (res, overflow) = self.overflowing_sub_signed(rhs);
if !overflow { Some(res) } else { None }
"assert_eq!(3u64.strict_sub_signed(2), 1);"
"let _ = 1u64.strict_sub_signed(2);"
"let _ = (u64::MAX).strict_sub_signed(-1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i64
rhs
Self
let (a, b) = self.overflowing_sub_signed(rhs);
if b { imp::overflow_panic::sub() } else { a }
"Checked integer subtraction. Computes `self - rhs` and checks if the result fits into an [`i64`], returning `None` if overflow occurred."
"assert_eq!(10u64.checked_signed_diff(2), Some(8));"
"assert_eq!(2u64.checked_signed_diff(10), Some(-8));"
"assert_eq!(u64::MAX.checked_signed_diff(i64::MAX as u64), None);"
"assert_eq!((i64::MAX as u64).checked_signed_diff(u64::MAX), Some(i64::MIN));"
"assert_eq!((i64::MAX as u64 + 1).checked_signed_diff(0), None);"
"assert_eq!(u64::MAX.checked_signed_diff(u64::MAX), Some(0));"
Self
self
Self
rhs
Option<i64>
let res = self.wrapping_sub(rhs) as i64;
let overflow = (self >= rhs) == (res < 0);
if !overflow { Some(res) } else { None }
"assert_eq!(5u64.checked_mul(1), Some(5));"
"assert_eq!(u64::MAX.checked_mul(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
let (a, b) = self.overflowing_mul(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!(5u64.strict_mul(1), 5);"
"let _ = u64::MAX.strict_mul(2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_mul(rhs);
if b { imp::overflow_panic::mul() } else { a }
"`self * rhs > u64::MAX` or `self * rhs < u64::MIN`,"
"[`checked_mul`]: u64::checked_mul"
"[`wrapping_mul`]: u64::wrapping_mul"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: u64, rhs: u64) {
        if !!lhs.overflowing_mul(rhs).1 {
            let msg =
                "unsafe precondition(s) violated: u64::unchecked_mul cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::unchecked_mul(self, rhs) }
"assert_eq!(128u64.checked_div(2), Some(64));"
"assert_eq!(1u64.checked_div(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0) {
    None
} else { Some(unsafe { intrinsics::unchecked_div(self, rhs) }) }
"assert_eq!(100u64.strict_div(10), 10);"
"let _ = (1u64).strict_div(0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self / rhs;
"assert_eq!(128u64.checked_div_euclid(2), Some(64));"
"assert_eq!(1u64.checked_div_euclid(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0) { None } else { Some(self.div_euclid(rhs)) }
"assert_eq!(100u64.strict_div_euclid(10), 10);"
"let _ = (1u64).strict_div_euclid(0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self / rhs;
"assert_eq!(64u64.checked_div_exact(2), Some(32));"
"assert_eq!(64u64.checked_div_exact(32), Some(2));"
"assert_eq!(64u64.checked_div_exact(0), None);"
"assert_eq!(65u64.checked_div_exact(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0) {
    None
} else {
    unsafe {
        if intrinsics::unlikely(intrinsics::unchecked_rem(self, rhs) != 0) {
            None
        } else { Some(intrinsics::exact_div(self, rhs)) }
    }
}
"assert_eq!(64u64.div_exact(2), Some(32));"
"assert_eq!(64u64.div_exact(32), Some(2));"
"assert_eq!(65u64.div_exact(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if self % rhs != 0 { None } else { Some(self / rhs) }
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: u64, rhs: u64) {
        if !(rhs > 0 && lhs % rhs == 0) {
            let msg =
                "unsafe precondition(s) violated: u64::unchecked_div_exact divide by zero or leave a remainder\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::exact_div(self, rhs) }
"assert_eq!(5u64.checked_rem(2), Some(1));"
"assert_eq!(5u64.checked_rem(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0) {
    None
} else { Some(unsafe { intrinsics::unchecked_rem(self, rhs) }) }
"assert_eq!(100u64.strict_rem(10), 0);"
"let _ = 5u64.strict_rem(0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self % rhs;
"assert_eq!(5u64.checked_rem_euclid(2), Some(1));"
"assert_eq!(5u64.checked_rem_euclid(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0) { None } else { Some(self.rem_euclid(rhs)) }
"assert_eq!(100u64.strict_rem_euclid(10), 0);"
"let _ = 5u64.strict_rem_euclid(0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self % rhs;
"    assert_eq!(1_u64.unchecked_disjoint_bitor(4), 5);"
Self
self
Self
other
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: u64, rhs: u64) {
        if !((lhs & rhs) == 0) {
            let msg =
                "unsafe precondition(s) violated: u64::unchecked_disjoint_bitor cannot have overlapping bits\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, other);
    }
};
unsafe { intrinsics::disjoint_bitor(self, other) }
"assert_eq!(5u64.ilog(5), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
base
u32
if !(base >= 2) {
    {
        crate::panicking::panic_fmt(format_args!("base of integer logarithm must be at least 2"));
    }
};
if let Some(log) = self.checked_ilog(base) {
    log
} else { imp::int_log10::panic_for_nonpositive_argument() }
"assert_eq!(2u64.ilog2(), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
if let Some(log) = self.checked_ilog2() {
    log
} else { imp::int_log10::panic_for_nonpositive_argument() }
"assert_eq!(10u64.ilog10(), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
if let Some(log) = self.checked_ilog10() {
    log
} else { imp::int_log10::panic_for_nonpositive_argument() }
"assert_eq!(5u64.checked_ilog(5), Some(1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
base
Option<u32>
if core::intrinsics::is_val_statically_known(base) {
    if base == 2 {
        return self.checked_ilog2();
    } else if base == 10 { return self.checked_ilog10(); }
}
if self <= 0 || base <= 1 {
    None
} else if self < base {
    Some(0)
} else {
    let mut n = 1;
    let mut r = base;
    if Self::BITS == 128 {
        n = self.ilog2() / (base.ilog2() + 1);
        r = base.pow(n);
    }
    while r <= self / base { n += 1; r *= base; }
    Some(n)
}
"assert_eq!(2u64.checked_ilog2(), Some(1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
match NonZero::new(self) { Some(x) => Some(x.ilog2()), None => None, }
"assert_eq!(10u64.checked_ilog10(), Some(1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
match NonZero::new(self) { Some(x) => Some(x.ilog10()), None => None, }
"assert_eq!(0u64.checked_neg(), Some(0));"
"assert_eq!(1u64.checked_neg(), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<Self>
let (a, b) = self.overflowing_neg();
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!(0u64.strict_neg(), 0);"
"let _ = 1u64.strict_neg();"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
let (a, b) = self.overflowing_neg();
if b { imp::overflow_panic::neg() } else { a }
"assert_eq!(0x1u64.checked_shl(4), Some(0x10));"
"assert_eq!(0x10u64.checked_shl(129), None);"
"assert_eq!(0x10u64.checked_shl(63), Some(0));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<Self>
if rhs < Self::BITS { Some(unsafe { self.unchecked_shl(rhs) }) } else { None }
"assert_eq!(0x1u64.strict_shl(4), 0x10);"
"let _ = 0x10u64.strict_shl(129);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
let (a, b) = self.overflowing_shl(rhs);
if b { imp::overflow_panic::shl() } else { a }
"[`checked_shl`]: u64::checked_shl"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(rhs: u32) {
        if !(rhs < <u64>::BITS) {
            let msg =
                "unsafe precondition(s) violated: u64::unchecked_shl cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(rhs); }
};
unsafe { intrinsics::unchecked_shl(self, rhs) }
"assert_eq!(0x1_u64.unbounded_shl(4), 0x10);"
"assert_eq!(0x1_u64.unbounded_shl(129), 0);"
"assert_eq!(0b101_u64.unbounded_shl(0), 0b101);"
"assert_eq!(0b101_u64.unbounded_shl(1), 0b1010);"
"assert_eq!(0b101_u64.unbounded_shl(2), 0b10100);"
"assert_eq!(42_u64.unbounded_shl(64), 0);"
"assert_eq!(42_u64.unbounded_shl(1).unbounded_shl(63), 0);"
"let start : u64 = 13;"
"    assert_eq!(running == start.wrapping_shl(i), i < 64);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
if rhs < Self::BITS { unsafe { self.unchecked_shl(rhs) } } else { 0 }
"`u64::BITS`."
"assert_eq!(0x1u64.shl_exact(4), Some(0x10));"
"assert_eq!(0x1u64.shl_exact(129), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<u64>
if rhs <= self.leading_zeros() && rhs < <u64>::BITS {
    Some(unsafe { self.unchecked_shl(rhs) })
} else { None }
"`u64::BITS`."
"u64::BITS`"
"[`u64::shl_exact`]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(zeros: u32, bits: u32, rhs: u32) {
        if !(rhs <= zeros && rhs < bits) {
            let msg =
                "unsafe precondition(s) violated: u64::unchecked_shl_exact cannot shift out non-zero bits\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_library_ub() {
        precondition_check(self.leading_zeros(), <u64>::BITS, rhs);
    }
};
unsafe { self.unchecked_shl(rhs) }
"assert_eq!(0x10u64.checked_shr(4), Some(0x1));"
"assert_eq!(0x10u64.checked_shr(129), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<Self>
if rhs < Self::BITS { Some(unsafe { self.unchecked_shr(rhs) }) } else { None }
"assert_eq!(0x10u64.strict_shr(4), 0x1);"
"let _ = 0x10u64.strict_shr(129);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
let (a, b) = self.overflowing_shr(rhs);
if b { imp::overflow_panic::shr() } else { a }
"[`checked_shr`]: u64::checked_shr"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(rhs: u32) {
        if !(rhs < <u64>::BITS) {
            let msg =
                "unsafe precondition(s) violated: u64::unchecked_shr cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(rhs); }
};
unsafe { intrinsics::unchecked_shr(self, rhs) }
"assert_eq!(0x10_u64.unbounded_shr(4), 0x1);"
"assert_eq!(0x10_u64.unbounded_shr(129), 0);"
"assert_eq!(0b1010_u64.unbounded_shr(0), 0b1010);"
"assert_eq!(0b1010_u64.unbounded_shr(1), 0b101);"
"assert_eq!(0b1010_u64.unbounded_shr(2), 0b10);"
"assert_eq!(42_u64.unbounded_shr(64), 0);"
"assert_eq!(42_u64.unbounded_shr(1).unbounded_shr(63), 0);"
"let start = u64::rotate_right(13, 4);"
"    assert_eq!(running == start.wrapping_shr(i), i < 64);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
if rhs < Self::BITS { unsafe { self.unchecked_shr(rhs) } } else { 0 }
"`u64::BITS`."
"assert_eq!(0x10u64.shr_exact(4), Some(0x1));"
"assert_eq!(0x10u64.shr_exact(5), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<u64>
if rhs <= self.trailing_zeros() && rhs < <u64>::BITS {
    Some(unsafe { self.unchecked_shr(rhs) })
} else { None }
"`u64::BITS`."
"u64::BITS`"
"[`u64::shr_exact`]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(zeros: u32, bits: u32, rhs: u32) {
        if !(rhs <= zeros && rhs < bits) {
            let msg =
                "unsafe precondition(s) violated: u64::unchecked_shr_exact cannot shift out non-zero bits\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_library_ub() {
        precondition_check(self.trailing_zeros(), <u64>::BITS, rhs);
    }
};
unsafe { self.unchecked_shr(rhs) }
"assert_eq!(2u64.checked_pow(5), Some(32));"
"assert_eq!(0_u64.checked_pow(0), Some(1));"
"assert_eq!(u64::MAX.checked_pow(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Option<Self>
if exp == 0 { return Some(1); }
let mut base = self;
let mut acc: Self = 1;
loop {
    if (exp & 1) == 1 {
        acc =
            match acc.checked_mul(base) {
                Some(x) => x,
                None => return None,
            };
        if exp == 1 { return Some(acc); }
    }
    exp /= 2;
    base =
        match base.checked_mul(base) { Some(x) => x, None => return None, };
}
"assert_eq!(2u64.strict_pow(5), 32);"
"assert_eq!(0_u64.strict_pow(0), 1);"
"let _ = u64::MAX.strict_pow(2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Self
if exp == 0 { return 1; }
let mut base = self;
let mut acc: Self = 1;
loop {
    if (exp & 1) == 1 {
        acc = acc.strict_mul(base);
        if exp == 1 { return acc; }
    }
    exp /= 2;
    base = base.strict_mul(base);
}
"assert_eq!(100u64.saturating_add(1), 101);"
"assert_eq!(u64::MAX.saturating_add(127), u64::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::saturating_add(self, rhs);
"assert_eq!(1u64.saturating_add_signed(2), 3);"
"assert_eq!(1u64.saturating_add_signed(-2), 0);"
"assert_eq!((u64::MAX - 2).saturating_add_signed(4), u64::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i64
rhs
Self
let (res, overflow) = self.overflowing_add(rhs as Self);
if overflow == (rhs < 0) { res } else if overflow { Self::MAX } else { 0 }
"assert_eq!(100u64.saturating_sub(27), 73);"
"assert_eq!(13u64.saturating_sub(127), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::saturating_sub(self, rhs);
"assert_eq!(1u64.saturating_sub_signed(2), 0);"
"assert_eq!(1u64.saturating_sub_signed(-2), 3);"
"assert_eq!((u64::MAX - 2).saturating_sub_signed(-4), u64::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i64
rhs
Self
let (res, overflow) = self.overflowing_sub_signed(rhs);
if !overflow { res } else if rhs < 0 { Self::MAX } else { 0 }
"assert_eq!(2u64.saturating_mul(10), 20);"
"assert_eq!((u64::MAX).saturating_mul(10), u64::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
match self.checked_mul(rhs) { Some(x) => x, None => Self::MAX, }
"assert_eq!(5u64.saturating_div(2), 2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self.wrapping_div(rhs);
"assert_eq!(4u64.saturating_pow(3), 64);"
"assert_eq!(0_u64.saturating_pow(0), 1);"
"assert_eq!(u64::MAX.saturating_pow(2), u64::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
exp
Self
match self.checked_pow(exp) { Some(x) => x, None => Self::MAX, }
"assert_eq!(200u64.wrapping_add(55), 255);"
"assert_eq!(200u64.wrapping_add(u64::MAX), 199);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::wrapping_add(self, rhs);
"assert_eq!(1u64.wrapping_add_signed(2), 3);"
"assert_eq!(1u64.wrapping_add_signed(-2), u64::MAX);"
"assert_eq!((u64::MAX - 2).wrapping_add_signed(4), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i64
rhs
Self
self.wrapping_add(rhs as Self);
"assert_eq!(100u64.wrapping_sub(100), 0);"
"assert_eq!(100u64.wrapping_sub(u64::MAX), 101);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::wrapping_sub(self, rhs);
"assert_eq!(1u64.wrapping_sub_signed(2), u64::MAX);"
"assert_eq!(1u64.wrapping_sub_signed(-2), 3);"
"assert_eq!((u64::MAX - 2).wrapping_sub_signed(-4), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i64
rhs
Self
self.wrapping_sub(rhs as Self);
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::wrapping_mul(self, rhs);
"assert_eq!(100u64.wrapping_div(10), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self / rhs;
"assert_eq!(100u64.wrapping_div_euclid(10), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self / rhs;
"assert_eq!(100u64.wrapping_rem(10), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self % rhs;
"assert_eq!(100u64.wrapping_rem_euclid(10), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self % rhs;
"assert_eq!(0_u64.wrapping_neg(), 0);"
"assert_eq!(u64::MAX.wrapping_neg(), 1);"
"assert_eq!(13_u64.wrapping_neg(), (!13) + 1);"
"assert_eq!(42_u64.wrapping_neg(), !(42 - 1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
(0 as u64).wrapping_sub(self);
"assert_eq!(1_u64.wrapping_shl(7), 128);"
"assert_eq!(0b101_u64.wrapping_shl(0), 0b101);"
"assert_eq!(0b101_u64.wrapping_shl(1), 0b1010);"
"assert_eq!(0b101_u64.wrapping_shl(2), 0b10100);"
"assert_eq!(u64::MAX.wrapping_shl(2), u64::MAX - 3);"
"assert_eq!(42_u64.wrapping_shl(64), 42);"
"assert_eq!(42_u64.wrapping_shl(1).wrapping_shl(63), 0);"
"assert_eq!(1_u64.wrapping_shl(128), 1);"
"assert_eq!(5_u64.wrapping_shl(1025), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
unsafe { self.unchecked_shl(rhs & (Self::BITS - 1)) }
"assert_eq!(128_u64.wrapping_shr(7), 1);"
"assert_eq!(0b1010_u64.wrapping_shr(0), 0b1010);"
"assert_eq!(0b1010_u64.wrapping_shr(1), 0b101);"
"assert_eq!(0b1010_u64.wrapping_shr(2), 0b10);"
"assert_eq!(u64::MAX.wrapping_shr(1), i64::MAX.cast_unsigned());"
"assert_eq!(42_u64.wrapping_shr(64), 42);"
"assert_eq!(42_u64.wrapping_shr(1).wrapping_shr(63), 0);"
"assert_eq!(128_u64.wrapping_shr(128), 128);"
"assert_eq!(10_u64.wrapping_shr(1025), 5);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
unsafe { self.unchecked_shr(rhs & (Self::BITS - 1)) }
"assert_eq!(3u64.wrapping_pow(5), 243);"
"assert_eq!(0_u64.wrapping_pow(0), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Self
if exp == 0 { return 1; }
let mut base = self;
let mut acc: Self = 1;
if intrinsics::is_val_statically_known(exp) {
    while exp > 1 {
        if (exp & 1) == 1 { acc = acc.wrapping_mul(base); }
        exp /= 2;
        base = base.wrapping_mul(base);
    }
    acc.wrapping_mul(base)
} else {
    loop {
        if (exp & 1) == 1 {
            acc = acc.wrapping_mul(base);
            if exp == 1 { return acc; }
        }
        exp /= 2;
        base = base.wrapping_mul(base);
    }
}
"assert_eq!(5u64.overflowing_add(2), (7, false));"
"assert_eq!(u64::MAX.overflowing_add(1), (0, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
let (a, b) = intrinsics::add_with_overflow(self as u64, rhs as u64);
(a as Self, b);
"This can be thought of as a 64-bit \"full adder\", in the electronics sense."
"//    3  MAX    (a = 3 \u{d7} 2^64 + 2^64 - 1)"
"// +  5    7    (b = 5 \u{d7} 2^64 + 7)"
"//    9    6    (sum = 9 \u{d7} 2^64 + 6)"
"let (a1, a0): (u64, u64) = (3, u64::MAX);"
"let (b1, b0): (u64, u64) = (5, 7);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
bool
carry
(Self, bool)
let (a, c1) = self.overflowing_add(rhs);
let (b, c2) = a.overflowing_add(carry as u64);
(b, unsafe { intrinsics::disjoint_bitor(c1, c2) });
"assert_eq!(1u64.overflowing_add_signed(2), (3, false));"
"assert_eq!(1u64.overflowing_add_signed(-2), (u64::MAX, true));"
"assert_eq!((u64::MAX - 2).overflowing_add_signed(4), (1, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i64
rhs
(Self, bool)
let (res, overflowed) = self.overflowing_add(rhs as Self);
(res, overflowed ^ (rhs < 0));
"assert_eq!(5u64.overflowing_sub(2), (3, false));"
"assert_eq!(0u64.overflowing_sub(1), (u64::MAX, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
let (a, b) = intrinsics::sub_with_overflow(self as u64, rhs as u64);
(a as Self, b);
"//    9    6    (a = 9 \u{d7} 2^64 + 6)"
"// -  5    7    (b = 5 \u{d7} 2^64 + 7)"
"//    3  MAX    (diff = 3 \u{d7} 2^64 + 2^64 - 1)"
"let (a1, a0): (u64, u64) = (9, 6);"
"let (b1, b0): (u64, u64) = (5, 7);"
"assert_eq!((diff1, diff0), (3, u64::MAX));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
bool
borrow
(Self, bool)
let (a, c1) = self.overflowing_sub(rhs);
let (b, c2) = a.overflowing_sub(borrow as u64);
(b, unsafe { intrinsics::disjoint_bitor(c1, c2) });
"assert_eq!(1u64.overflowing_sub_signed(2), (u64::MAX, true));"
"assert_eq!(1u64.overflowing_sub_signed(-2), (3, false));"
"assert_eq!((u64::MAX - 2).overflowing_sub_signed(-4), (1, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i64
rhs
(Self, bool)
let (res, overflow) = self.overflowing_sub(rhs as Self);
(res, overflow ^ (rhs < 0));
"assert_eq!(100u64.abs_diff(80), 20u64);"
"assert_eq!(100u64.abs_diff(110), 10u64);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
other
Self
if size_of::<Self>() == 1 {
    (self as i32).wrapping_sub(other as i32).unsigned_abs() as Self
} else { if self < other { other - self } else { self - other } }
"this returns the result of the operation, \
                          without modifying the original"
Self
self
Self
rhs
(Self, bool)
let (a, b) = intrinsics::mul_with_overflow(self as u64, rhs as u64);
(a as Self, b);
"assert_eq!(5_u64.widening_mul(7), (35, 0));"
"assert_eq!(u64::MAX.widening_mul(u64::MAX), (1, u64::MAX - 1));"
"assert_eq!(u64::widening_mul(1 << 63, 6), (0, 3));"
"assert_eq!(u64::overflowing_mul(1 << 63, 6), (0, true));"
"assert_eq!(u64::wrapping_mul(1 << 63, 6), 0);"
"assert_eq!(u64::checked_mul(1 << 63, 6), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, Self)
Self::carrying_mul_add(self, rhs, 0, 0);
"assert_eq!(u64::MAX.carrying_mul(u64::MAX, u64::MAX), (0, u64::MAX));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
carry
(Self, Self)
Self::carrying_mul_add(self, rhs, carry, 0);
"assert_eq!(u64::MAX.carrying_mul_add(u64::MAX, u64::MAX, u64::MAX), (u64::MAX, u64::MAX));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
carry
Self
add
(Self, Self)
intrinsics::carrying_mul_add(self, rhs, carry, add);
"assert_eq!(5u64.overflowing_div(2), (2, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
(self / rhs, false);
"assert_eq!(5u64.overflowing_div_euclid(2), (2, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
(self / rhs, false);
"assert_eq!(5u64.overflowing_rem(2), (1, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
(self % rhs, false);
"assert_eq!(5u64.overflowing_rem_euclid(2), (1, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
(self % rhs, false);
"assert_eq!(0u64.overflowing_neg(), (0, false));"
"assert_eq!(2u64.overflowing_neg(), (-2i32 as u64, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
(Self, bool)
((!self).wrapping_add(1), self != 0);
"assert_eq!(0x1u64.overflowing_shl(4), (0x10, false));"
"assert_eq!(0x1u64.overflowing_shl(132), (0x10, true));"
"assert_eq!(0x10u64.overflowing_shl(63), (0, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
(Self, bool)
(self.wrapping_shl(rhs), rhs >= Self::BITS);
"assert_eq!(0x10u64.overflowing_shr(4), (0x1, false));"
"assert_eq!(0x10u64.overflowing_shr(132), (0x1, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
(Self, bool)
(self.wrapping_shr(rhs), rhs >= Self::BITS);
"assert_eq!(3u64.overflowing_pow(5), (243, false));"
"assert_eq!(0_u64.overflowing_pow(0), (1, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
(Self, bool)
if exp == 0 { return (1, false); }
let mut base = self;
let mut acc: Self = 1;
let mut overflown = false;
let mut r;
loop {
    if (exp & 1) == 1 {
        r = acc.overflowing_mul(base);
        if exp == 1 { r.1 |= overflown; return r; }
        acc = r.0;
        overflown |= r.1;
    }
    exp /= 2;
    r = base.overflowing_mul(base);
    base = r.0;
    overflown |= r.1;
}
"assert_eq!(2u64.pow(5), 32);"
"assert_eq!(0_u64.pow(0), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Self
if exp == 0 { return 1; }
let mut base = self;
let mut acc = 1;
if intrinsics::is_val_statically_known(exp) {
    while exp > 1 {
        if (exp & 1) == 1 { acc = acc * base; }
        exp /= 2;
        base = base * base;
    }
    acc * base
} else {
    loop {
        if (exp & 1) == 1 { acc = acc * base; if exp == 1 { return acc; } }
        exp /= 2;
        base = base * base;
    }
}
"assert_eq!(10u64.isqrt(), 3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
let result = imp::int_sqrt::u64(self as u64) as u64;
unsafe {
    const MAX_RESULT: u64 = imp::int_sqrt::u64(<u64>::MAX) as u64;
    crate::hint::assert_unchecked(result <= MAX_RESULT);
}
result;
"assert_eq!(7u64.div_euclid(4), 1); // or any other integer type"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self / rhs;
"assert_eq!(7u64.rem_euclid(4), 3); // or any other integer type"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self % rhs;
"assert_eq!(7_u64.div_floor(4), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self / rhs;
"assert_eq!(7_u64.div_ceil(4), 2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let d = self / rhs;
let r = self % rhs;
if r > 0 { d + 1 } else { d }
"assert_eq!(16_u64.next_multiple_of(8), 16);"
"assert_eq!(23_u64.next_multiple_of(8), 24);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
match self % rhs { 0 => self, r => self + (rhs - r), }
"assert_eq!(16_u64.checked_next_multiple_of(8), Some(16));"
"assert_eq!(23_u64.checked_next_multiple_of(8), Some(24));"
"assert_eq!(1_u64.checked_next_multiple_of(0), None);"
"assert_eq!(u64::MAX.checked_next_multiple_of(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
match match self.checked_rem(rhs) { Some(x) => x, None => return None, } {
    0 => Some(self),
    r => self.checked_add(rhs - r),
}
"assert!(6_u64.is_multiple_of(2));"
"assert!(!5_u64.is_multiple_of(2));"
"assert!(0_u64.is_multiple_of(0));"
"assert!(!6_u64.is_multiple_of(0));"
Self
self
Self
rhs
bool
match rhs { 0 => self == 0, _ => self % rhs == 0, }
"assert!(16u64.is_power_of_two());"
"assert!(!10u64.is_power_of_two());"
Self
self
bool
self.count_ones() == 1;
Self
self
Self
if self <= 1 { return 0; }
let p = self - 1;
let z = unsafe { intrinsics::ctlz_nonzero(p) };
<u64>::MAX >> z;
"assert_eq!(2u64.next_power_of_two(), 2);"
"assert_eq!(3u64.next_power_of_two(), 4);"
"assert_eq!(0u64.next_power_of_two(), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
self.one_less_than_next_power_of_two() + 1;
"assert_eq!(2u64.checked_next_power_of_two(), Some(2));"
"assert_eq!(3u64.checked_next_power_of_two(), Some(4));"
"assert_eq!(u64::MAX.checked_next_power_of_two(), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<Self>
self.one_less_than_next_power_of_two().checked_add(1);
"assert_eq!(2u64.wrapping_next_power_of_two(), 2);"
"assert_eq!(3u64.wrapping_next_power_of_two(), 4);"
"assert_eq!(u64::MAX.wrapping_next_power_of_two(), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
self.one_less_than_next_power_of_two().wrapping_add(1);
"let bytes = 0x1234567890123456u64.to_be_bytes();"
"assert_eq!(bytes, [0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
self.to_be().to_ne_bytes();
"let bytes = 0x1234567890123456u64.to_le_bytes();"
"assert_eq!(bytes, [0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
self.to_le().to_ne_bytes();
"let bytes = 0x1234567890123456u64.to_ne_bytes();"
"        [0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]"
"        [0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
unsafe { mem::transmute(self) }
"let value = u64::from_be_bytes([0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]);"
"assert_eq!(value, 0x1234567890123456);"
"fn read_be_u64(input: &mut &[u8]) -> u64 {"
"    let (int_bytes, rest) = input.split_at(size_of::<u64>());"
"    u64::from_be_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
Self::from_be(Self::from_ne_bytes(bytes));
"let value = u64::from_le_bytes([0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]);"
"assert_eq!(value, 0x1234567890123456);"
"fn read_le_u64(input: &mut &[u8]) -> u64 {"
"    let (int_bytes, rest) = input.split_at(size_of::<u64>());"
"    u64::from_le_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
Self::from_le(Self::from_ne_bytes(bytes));
"let value = u64::from_ne_bytes(if cfg!(target_endian = \"big\") {"
"    [0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]"
"    [0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]"
"assert_eq!(value, 0x1234567890123456);"
"fn read_ne_u64(input: &mut &[u8]) -> u64 {"
"    let (int_bytes, rest) = input.split_at(size_of::<u64>());"
"    u64::from_ne_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
unsafe { mem::transmute(bytes) }
"[`u64::MIN`] instead."
"u64_legacy_fn_min_value"
Self
Self::MIN;
"[`u64::MAX`] instead."
"u64_legacy_fn_max_value"
Self
Self::MAX;
"assert_eq!(120u8, 120u64.truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Target
traits::TruncateTarget::internal_truncate(self);
"assert_eq!(120u8, 120u64.saturating_truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Target
traits::TruncateTarget::internal_saturating_truncate(self);
"assert_eq!(Some(120u8), 120u64.checked_truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Option<Target>
traits::TruncateTarget::internal_checked_truncate(self);
"assert_eq!(120u128, 120u8.extend());"
"this returns the extended value and does not modify the original"
Self
Target
Self
self
Target
traits::ExtendTarget::internal_extend(self);uint_impl! {
1271        Self = u64,
1272        ActualT = u64,
1273        SignedT = i64,
1274        BITS = 64,
1275        BITS_MINUS_ONE = 63,
1276        MAX = 18446744073709551615,
1277        rot = 12,
1278        rot_op = "0xaa00000000006e1",
1279        rot_result = "0x6e10aa",
1280        fsh_op = "0x2fe78e45983acd98",
1281        fshl_result = "0x6e12fe",
1282        fshr_result = "0x6e12fe78e45983ac",
1283        clmul_lhs = "0x7890123456789012",
1284        clmul_rhs = "0xdd358416f52ecd34",
1285        clmul_result = "0xa6299579b980928",
1286        swap_op = "0x1234567890123456",
1287        swapped = "0x5634129078563412",
1288        reversed = "0x6a2c48091e6a2c48",
1289        le_bytes = "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
1290        be_bytes = "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]",
1291        to_xe_bytes_doc = "",
1292        from_xe_bytes_doc = "",
1293        bound_condition = "",
1294    }
1295    "assert_eq!(0u64.midpoint(4), 2);"
"assert_eq!(1u64.midpoint(4), 2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
((self as u128 + rhs as u128) / 2) as u64;midpoint_impl! { u64, u128, unsigned }
1296    "assert_eq!(u64::MAX.widening_carryless_mul(u64::MAX), u128::MAX / 3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
(self as u128).carryless_mul(rhs as u128);widening_carryless_mul_impl! { u64, u128 }
1297    self
Self
rhs
Self
carry
(Self, Self)
let p = (self as u128).carryless_mul(rhs as u128);
let lo = (p as u64);
let hi = (p >> Self::BITS) as u64;
(lo ^ carry, hi);carrying_carryless_mul_impl! { u64, u128 }
1298}
1299
1300impl u128 {
1301    "assert_eq!(u128::MIN, 0);"
Self
0
"(2<sup>128</sup> &minus; 1)."
"assert_eq!(u128::MAX, 340282366920938463463374607431768211455);"
Self
!0
"assert_eq!(u128::BITS, 128);"
u32
Self::MAX.count_ones()
"let n = 0b01001100u128;"
"let max = u128::MAX;"
"assert_eq!(max.count_ones(), 128);"
"let zero = 0u128;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
return intrinsics::ctpop(self);
"let zero = 0u128;"
"assert_eq!(zero.count_zeros(), 128);"
"let max = u128::MAX;"
"assert_eq!(u128::count_zeros(small), 127);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(!self).count_ones();
"let n = u128::MAX >> 2;"
"let zero = 0u128;"
"assert_eq!(zero.leading_zeros(), 128);"
"let max = u128::MAX;"
"[`ilog2`]: u128::ilog2"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
return intrinsics::ctlz(self as u128);
"let n = 0b0101000u128;"
"let zero = 0u128;"
"assert_eq!(zero.trailing_zeros(), 128);"
"let max = u128::MAX;"
"assert_eq!(max.trailing_zeros(), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
return intrinsics::cttz(self);
"let n = !(u128::MAX >> 2);"
"let zero = 0u128;"
"let max = u128::MAX;"
"assert_eq!(max.leading_ones(), 128);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(!self).leading_zeros();
"let n = 0b1010111u128;"
"let zero = 0u128;"
"let max = u128::MAX;"
"assert_eq!(max.trailing_ones(), 128);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
(!self).trailing_zeros();
"assert_eq!(0_u128.bit_width(), 0);"
"assert_eq!(0b111_u128.bit_width(), 3);"
"assert_eq!(0b1110_u128.bit_width(), 4);"
"assert_eq!(u128::MAX.bit_width(), 128);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
Self::BITS - self.leading_zeros();
"let n: u128 = 0b_01100100;"
"assert_eq!(0_u128.isolate_highest_one(), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
self &
    (((1 as u128) << (<u128>::BITS - 1)).wrapping_shr(self.leading_zeros()));
"let n: u128 = 0b_01100100;"
"assert_eq!(0_u128.isolate_lowest_one(), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
self & self.wrapping_neg();
"assert_eq!(0b0_u128.highest_one(), None);"
"assert_eq!(0b1_u128.highest_one(), Some(0));"
"assert_eq!(0b1_0000_u128.highest_one(), Some(4));"
"assert_eq!(0b1_1111_u128.highest_one(), Some(4));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
match NonZero::new(self) { Some(v) => Some(v.highest_one()), None => None, }
"assert_eq!(0b0_u128.lowest_one(), None);"
"assert_eq!(0b1_u128.lowest_one(), Some(0));"
"assert_eq!(0b1_0000_u128.lowest_one(), Some(4));"
"assert_eq!(0b1_1111_u128.lowest_one(), Some(0));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
match NonZero::new(self) { Some(v) => Some(v.lowest_one()), None => None, }
"let n = u128::MAX;"
"assert_eq!(n.cast_signed(), -1i128);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i128
self as i128;
"let n = 0x13f40000000000000000000000004f76u128;"
"let m = 0x4f7613f4;"
"assert_eq!(n.rotate_left(16), m);"
"assert_eq!(n.rotate_left(1024), n);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
n
Self
return intrinsics::rotate_left(self, n);
"let n = 0x4f7613f4u128;"
"let m = 0x13f40000000000000000000000004f76;"
"assert_eq!(n.rotate_right(16), m);"
"assert_eq!(n.rotate_right(1024), n);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
n
Self
return intrinsics::rotate_right(self, n);
"let a = 0x13f40000000000000000000000004f76u128;"
"let b = 0x2fe78e45983acd98039000008736273u128;"
"let m = 0x4f7602fe;"
"assert_eq!(a.funnel_shl(b, 16), m);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
u32
n
Self
if !(n < Self::BITS) {
    {
        crate::panicking::panic_fmt(format_args!("attempt to funnel shift left with overflow"));
    }
};
unsafe { self.unchecked_funnel_shl(rhs, n) }
"let a = 0x13f40000000000000000000000004f76u128;"
"let b = 0x2fe78e45983acd98039000008736273u128;"
"let m = 0x4f7602fe78e45983acd9803900000873;"
"assert_eq!(a.funnel_shr(b, 16), m);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
u32
n
Self
if !(n < Self::BITS) {
    {
        crate::panicking::panic_fmt(format_args!("attempt to funnel shift right with overflow"));
    }
};
unsafe { self.unchecked_funnel_shr(rhs, n) }
"`u128::BITS`,"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
low
u32
n
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(n: u32) {
        if !(n < <u128>::BITS) {
            let msg =
                "unsafe precondition(s) violated: u128::unchecked_funnel_shl cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(n); }
};
unsafe { intrinsics::unchecked_funnel_shl(self, low, n) }
"`u128::BITS`,"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
low
u32
n
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(n: u32) {
        if !(n < <u128>::BITS) {
            let msg =
                "unsafe precondition(s) violated: u128::unchecked_funnel_shr cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(n); }
};
unsafe { intrinsics::unchecked_funnel_shr(self, low, n) }
"pub fn carryless_mul(lhs: u128, rhs: u128) -> u128{"
"    for i in 0..u128::BITS {"
"let a = 0x12345678901234567890123456789012u128;"
"let b = 0x4317e40ab4ddcf05dd358416f52ecd34u128;"
"assert_eq!(a.carryless_mul(b), 0xb9cf660de35d0c170a6299579b980928);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::carryless_mul(self, rhs);
"let n = 0x12345678901234567890123456789012u128;"
"assert_eq!(m, 0x12907856341290785634129078563412);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
intrinsics::bswap(self as u128) as Self;
"let n: u128 = 0b1011_1100;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
mask
Self
imp::int_bits::u128::extract_impl(self as u128, mask as u128) as u128;
"let n: u128 = 0b1010_1101;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
mask
Self
imp::int_bits::u128::deposit_impl(self as u128, mask as u128) as u128;
"let n = 0x12345678901234567890123456789012u128;"
"assert_eq!(m, 0x48091e6a2c48091e6a2c48091e6a2c48);"
"assert_eq!(0, 0u128.reverse_bits());"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
intrinsics::bitreverse(self as u128) as Self;
"let n = 0x1Au128;"
"    assert_eq!(u128::from_be(n), n)"
"    assert_eq!(u128::from_be(n), n.swap_bytes())"
Self
x
Self
{ x.swap_bytes() }
"let n = 0x1Au128;"
"    assert_eq!(u128::from_le(n), n)"
"    assert_eq!(u128::from_le(n), n.swap_bytes())"
Self
x
Self
{ x }
"let n = 0x1Au128;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
{ self.swap_bytes() }
"let n = 0x1Au128;"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
{ self }
"assert_eq!((u128::MAX - 2).checked_add(1), Some(u128::MAX - 1));"
"assert_eq!((u128::MAX - 2).checked_add(3), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(intrinsics::add_with_overflow(self, rhs).1) {
    None
} else { Some(unsafe { intrinsics::unchecked_add(self, rhs) }) }
"assert_eq!((u128::MAX - 2).strict_add(1), u128::MAX - 1);"
"let _ = (u128::MAX - 2).strict_add(3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_add(rhs);
if b { imp::overflow_panic::add() } else { a }
"`self + rhs > u128::MAX` or `self + rhs < u128::MIN`,"
"[`checked_add`]: u128::checked_add"
"[`wrapping_add`]: u128::wrapping_add"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: u128, rhs: u128) {
        if !!lhs.overflowing_add(rhs).1 {
            let msg =
                "unsafe precondition(s) violated: u128::unchecked_add cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::unchecked_add(self, rhs) }
"assert_eq!(1u128.checked_add_signed(2), Some(3));"
"assert_eq!(1u128.checked_add_signed(-2), None);"
"assert_eq!((u128::MAX - 2).checked_add_signed(3), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i128
rhs
Option<Self>
let (a, b) = self.overflowing_add_signed(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!(1u128.strict_add_signed(2), 3);"
"let _ = 1u128.strict_add_signed(-2);"
"let _ = (u128::MAX - 2).strict_add_signed(3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i128
rhs
Self
let (a, b) = self.overflowing_add_signed(rhs);
if b { imp::overflow_panic::add() } else { a }
"assert_eq!(1u128.checked_sub(1), Some(0));"
"assert_eq!(0u128.checked_sub(1), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if self < rhs {
    None
} else { Some(unsafe { intrinsics::unchecked_sub(self, rhs) }) }
"assert_eq!(1u128.strict_sub(1), 0);"
"let _ = 0u128.strict_sub(1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_sub(rhs);
if b { imp::overflow_panic::sub() } else { a }
"`self - rhs > u128::MAX` or `self - rhs < u128::MIN`,"
"[`checked_sub`]: u128::checked_sub"
"[`wrapping_sub`]: u128::wrapping_sub"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: u128, rhs: u128) {
        if !!lhs.overflowing_sub(rhs).1 {
            let msg =
                "unsafe precondition(s) violated: u128::unchecked_sub cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::unchecked_sub(self, rhs) }
"assert_eq!(1u128.checked_sub_signed(2), None);"
"assert_eq!(1u128.checked_sub_signed(-2), Some(3));"
"assert_eq!((u128::MAX - 2).checked_sub_signed(-4), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i128
rhs
Option<Self>
let (res, overflow) = self.overflowing_sub_signed(rhs);
if !overflow { Some(res) } else { None }
"assert_eq!(3u128.strict_sub_signed(2), 1);"
"let _ = 1u128.strict_sub_signed(2);"
"let _ = (u128::MAX).strict_sub_signed(-1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i128
rhs
Self
let (a, b) = self.overflowing_sub_signed(rhs);
if b { imp::overflow_panic::sub() } else { a }
"Checked integer subtraction. Computes `self - rhs` and checks if the result fits into an [`i128`], returning `None` if overflow occurred."
"assert_eq!(10u128.checked_signed_diff(2), Some(8));"
"assert_eq!(2u128.checked_signed_diff(10), Some(-8));"
"assert_eq!(u128::MAX.checked_signed_diff(i128::MAX as u128), None);"
"assert_eq!((i128::MAX as u128).checked_signed_diff(u128::MAX), Some(i128::MIN));"
"assert_eq!((i128::MAX as u128 + 1).checked_signed_diff(0), None);"
"assert_eq!(u128::MAX.checked_signed_diff(u128::MAX), Some(0));"
Self
self
Self
rhs
Option<i128>
let res = self.wrapping_sub(rhs) as i128;
let overflow = (self >= rhs) == (res < 0);
if !overflow { Some(res) } else { None }
"assert_eq!(5u128.checked_mul(1), Some(5));"
"assert_eq!(u128::MAX.checked_mul(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
let (a, b) = self.overflowing_mul(rhs);
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!(5u128.strict_mul(1), 5);"
"let _ = u128::MAX.strict_mul(2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let (a, b) = self.overflowing_mul(rhs);
if b { imp::overflow_panic::mul() } else { a }
"`self * rhs > u128::MAX` or `self * rhs < u128::MIN`,"
"[`checked_mul`]: u128::checked_mul"
"[`wrapping_mul`]: u128::wrapping_mul"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: u128, rhs: u128) {
        if !!lhs.overflowing_mul(rhs).1 {
            let msg =
                "unsafe precondition(s) violated: u128::unchecked_mul cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::unchecked_mul(self, rhs) }
"assert_eq!(128u128.checked_div(2), Some(64));"
"assert_eq!(1u128.checked_div(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0) {
    None
} else { Some(unsafe { intrinsics::unchecked_div(self, rhs) }) }
"assert_eq!(100u128.strict_div(10), 10);"
"let _ = (1u128).strict_div(0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self / rhs;
"assert_eq!(128u128.checked_div_euclid(2), Some(64));"
"assert_eq!(1u128.checked_div_euclid(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0) { None } else { Some(self.div_euclid(rhs)) }
"assert_eq!(100u128.strict_div_euclid(10), 10);"
"let _ = (1u128).strict_div_euclid(0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self / rhs;
"assert_eq!(64u128.checked_div_exact(2), Some(32));"
"assert_eq!(64u128.checked_div_exact(32), Some(2));"
"assert_eq!(64u128.checked_div_exact(0), None);"
"assert_eq!(65u128.checked_div_exact(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0) {
    None
} else {
    unsafe {
        if intrinsics::unlikely(intrinsics::unchecked_rem(self, rhs) != 0) {
            None
        } else { Some(intrinsics::exact_div(self, rhs)) }
    }
}
"assert_eq!(64u128.div_exact(2), Some(32));"
"assert_eq!(64u128.div_exact(32), Some(2));"
"assert_eq!(65u128.div_exact(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if self % rhs != 0 { None } else { Some(self / rhs) }
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: u128, rhs: u128) {
        if !(rhs > 0 && lhs % rhs == 0) {
            let msg =
                "unsafe precondition(s) violated: u128::unchecked_div_exact divide by zero or leave a remainder\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, rhs);
    }
};
unsafe { intrinsics::exact_div(self, rhs) }
"assert_eq!(5u128.checked_rem(2), Some(1));"
"assert_eq!(5u128.checked_rem(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0) {
    None
} else { Some(unsafe { intrinsics::unchecked_rem(self, rhs) }) }
"assert_eq!(100u128.strict_rem(10), 0);"
"let _ = 5u128.strict_rem(0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self % rhs;
"assert_eq!(5u128.checked_rem_euclid(2), Some(1));"
"assert_eq!(5u128.checked_rem_euclid(0), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
if intrinsics::unlikely(rhs == 0) { None } else { Some(self.rem_euclid(rhs)) }
"assert_eq!(100u128.strict_rem_euclid(10), 0);"
"let _ = 5u128.strict_rem_euclid(0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self % rhs;
"    assert_eq!(1_u128.unchecked_disjoint_bitor(4), 5);"
Self
self
Self
other
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(lhs: u128, rhs: u128) {
        if !((lhs & rhs) == 0) {
            let msg =
                "unsafe precondition(s) violated: u128::unchecked_disjoint_bitor cannot have overlapping bits\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() {
        precondition_check(self, other);
    }
};
unsafe { intrinsics::disjoint_bitor(self, other) }
"assert_eq!(5u128.ilog(5), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
base
u32
if !(base >= 2) {
    {
        crate::panicking::panic_fmt(format_args!("base of integer logarithm must be at least 2"));
    }
};
if let Some(log) = self.checked_ilog(base) {
    log
} else { imp::int_log10::panic_for_nonpositive_argument() }
"assert_eq!(2u128.ilog2(), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
if let Some(log) = self.checked_ilog2() {
    log
} else { imp::int_log10::panic_for_nonpositive_argument() }
"assert_eq!(10u128.ilog10(), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
if let Some(log) = self.checked_ilog10() {
    log
} else { imp::int_log10::panic_for_nonpositive_argument() }
"assert_eq!(5u128.checked_ilog(5), Some(1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
base
Option<u32>
if core::intrinsics::is_val_statically_known(base) {
    if base == 2 {
        return self.checked_ilog2();
    } else if base == 10 { return self.checked_ilog10(); }
}
if self <= 0 || base <= 1 {
    None
} else if self < base {
    Some(0)
} else {
    let mut n = 1;
    let mut r = base;
    if Self::BITS == 128 {
        n = self.ilog2() / (base.ilog2() + 1);
        r = base.pow(n);
    }
    while r <= self / base { n += 1; r *= base; }
    Some(n)
}
"assert_eq!(2u128.checked_ilog2(), Some(1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
match NonZero::new(self) { Some(x) => Some(x.ilog2()), None => None, }
"assert_eq!(10u128.checked_ilog10(), Some(1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<u32>
match NonZero::new(self) { Some(x) => Some(x.ilog10()), None => None, }
"assert_eq!(0u128.checked_neg(), Some(0));"
"assert_eq!(1u128.checked_neg(), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<Self>
let (a, b) = self.overflowing_neg();
if intrinsics::unlikely(b) { None } else { Some(a) }
"assert_eq!(0u128.strict_neg(), 0);"
"let _ = 1u128.strict_neg();"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
let (a, b) = self.overflowing_neg();
if b { imp::overflow_panic::neg() } else { a }
"assert_eq!(0x1u128.checked_shl(4), Some(0x10));"
"assert_eq!(0x10u128.checked_shl(129), None);"
"assert_eq!(0x10u128.checked_shl(127), Some(0));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<Self>
if rhs < Self::BITS { Some(unsafe { self.unchecked_shl(rhs) }) } else { None }
"assert_eq!(0x1u128.strict_shl(4), 0x10);"
"let _ = 0x10u128.strict_shl(129);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
let (a, b) = self.overflowing_shl(rhs);
if b { imp::overflow_panic::shl() } else { a }
"[`checked_shl`]: u128::checked_shl"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(rhs: u32) {
        if !(rhs < <u128>::BITS) {
            let msg =
                "unsafe precondition(s) violated: u128::unchecked_shl cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(rhs); }
};
unsafe { intrinsics::unchecked_shl(self, rhs) }
"assert_eq!(0x1_u128.unbounded_shl(4), 0x10);"
"assert_eq!(0x1_u128.unbounded_shl(129), 0);"
"assert_eq!(0b101_u128.unbounded_shl(0), 0b101);"
"assert_eq!(0b101_u128.unbounded_shl(1), 0b1010);"
"assert_eq!(0b101_u128.unbounded_shl(2), 0b10100);"
"assert_eq!(42_u128.unbounded_shl(128), 0);"
"assert_eq!(42_u128.unbounded_shl(1).unbounded_shl(127), 0);"
"let start : u128 = 13;"
"    assert_eq!(running == start.wrapping_shl(i), i < 128);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
if rhs < Self::BITS { unsafe { self.unchecked_shl(rhs) } } else { 0 }
"`u128::BITS`."
"assert_eq!(0x1u128.shl_exact(4), Some(0x10));"
"assert_eq!(0x1u128.shl_exact(129), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<u128>
if rhs <= self.leading_zeros() && rhs < <u128>::BITS {
    Some(unsafe { self.unchecked_shl(rhs) })
} else { None }
"`u128::BITS`."
"u128::BITS`"
"[`u128::shl_exact`]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(zeros: u32, bits: u32, rhs: u32) {
        if !(rhs <= zeros && rhs < bits) {
            let msg =
                "unsafe precondition(s) violated: u128::unchecked_shl_exact cannot shift out non-zero bits\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_library_ub() {
        precondition_check(self.leading_zeros(), <u128>::BITS, rhs);
    }
};
unsafe { self.unchecked_shl(rhs) }
"assert_eq!(0x10u128.checked_shr(4), Some(0x1));"
"assert_eq!(0x10u128.checked_shr(129), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<Self>
if rhs < Self::BITS { Some(unsafe { self.unchecked_shr(rhs) }) } else { None }
"assert_eq!(0x10u128.strict_shr(4), 0x1);"
"let _ = 0x10u128.strict_shr(129);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
let (a, b) = self.overflowing_shr(rhs);
if b { imp::overflow_panic::shr() } else { a }
"[`checked_shr`]: u128::checked_shr"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(rhs: u32) {
        if !(rhs < <u128>::BITS) {
            let msg =
                "unsafe precondition(s) violated: u128::unchecked_shr cannot overflow\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_language_ub() { precondition_check(rhs); }
};
unsafe { intrinsics::unchecked_shr(self, rhs) }
"assert_eq!(0x10_u128.unbounded_shr(4), 0x1);"
"assert_eq!(0x10_u128.unbounded_shr(129), 0);"
"assert_eq!(0b1010_u128.unbounded_shr(0), 0b1010);"
"assert_eq!(0b1010_u128.unbounded_shr(1), 0b101);"
"assert_eq!(0b1010_u128.unbounded_shr(2), 0b10);"
"assert_eq!(42_u128.unbounded_shr(128), 0);"
"assert_eq!(42_u128.unbounded_shr(1).unbounded_shr(127), 0);"
"let start = u128::rotate_right(13, 4);"
"    assert_eq!(running == start.wrapping_shr(i), i < 128);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
if rhs < Self::BITS { unsafe { self.unchecked_shr(rhs) } } else { 0 }
"`u128::BITS`."
"assert_eq!(0x10u128.shr_exact(4), Some(0x1));"
"assert_eq!(0x10u128.shr_exact(5), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Option<u128>
if rhs <= self.trailing_zeros() && rhs < <u128>::BITS {
    Some(unsafe { self.unchecked_shr(rhs) })
} else { None }
"`u128::BITS`."
"u128::BITS`"
"[`u128::shr_exact`]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
{
    #[rustc_no_mir_inline]
    #[inline]
    #[rustc_nounwind]
    #[track_caller]
    const fn precondition_check(zeros: u32, bits: u32, rhs: u32) {
        if !(rhs <= zeros && rhs < bits) {
            let msg =
                "unsafe precondition(s) violated: u128::unchecked_shr_exact cannot shift out non-zero bits\n\nThis indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.";
            ::core::panicking::panic_nounwind_fmt(::core::fmt::Arguments::from_str(msg),
                false);
        }
    }
    if ::core::ub_checks::check_library_ub() {
        precondition_check(self.trailing_zeros(), <u128>::BITS, rhs);
    }
};
unsafe { self.unchecked_shr(rhs) }
"assert_eq!(2u128.checked_pow(5), Some(32));"
"assert_eq!(0_u128.checked_pow(0), Some(1));"
"assert_eq!(u128::MAX.checked_pow(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Option<Self>
if exp == 0 { return Some(1); }
let mut base = self;
let mut acc: Self = 1;
loop {
    if (exp & 1) == 1 {
        acc =
            match acc.checked_mul(base) {
                Some(x) => x,
                None => return None,
            };
        if exp == 1 { return Some(acc); }
    }
    exp /= 2;
    base =
        match base.checked_mul(base) { Some(x) => x, None => return None, };
}
"assert_eq!(2u128.strict_pow(5), 32);"
"assert_eq!(0_u128.strict_pow(0), 1);"
"let _ = u128::MAX.strict_pow(2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Self
if exp == 0 { return 1; }
let mut base = self;
let mut acc: Self = 1;
loop {
    if (exp & 1) == 1 {
        acc = acc.strict_mul(base);
        if exp == 1 { return acc; }
    }
    exp /= 2;
    base = base.strict_mul(base);
}
"assert_eq!(100u128.saturating_add(1), 101);"
"assert_eq!(u128::MAX.saturating_add(127), u128::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::saturating_add(self, rhs);
"assert_eq!(1u128.saturating_add_signed(2), 3);"
"assert_eq!(1u128.saturating_add_signed(-2), 0);"
"assert_eq!((u128::MAX - 2).saturating_add_signed(4), u128::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i128
rhs
Self
let (res, overflow) = self.overflowing_add(rhs as Self);
if overflow == (rhs < 0) { res } else if overflow { Self::MAX } else { 0 }
"assert_eq!(100u128.saturating_sub(27), 73);"
"assert_eq!(13u128.saturating_sub(127), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::saturating_sub(self, rhs);
"assert_eq!(1u128.saturating_sub_signed(2), 0);"
"assert_eq!(1u128.saturating_sub_signed(-2), 3);"
"assert_eq!((u128::MAX - 2).saturating_sub_signed(-4), u128::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i128
rhs
Self
let (res, overflow) = self.overflowing_sub_signed(rhs);
if !overflow { res } else if rhs < 0 { Self::MAX } else { 0 }
"assert_eq!(2u128.saturating_mul(10), 20);"
"assert_eq!((u128::MAX).saturating_mul(10), u128::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
match self.checked_mul(rhs) { Some(x) => x, None => Self::MAX, }
"assert_eq!(5u128.saturating_div(2), 2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self.wrapping_div(rhs);
"assert_eq!(4u128.saturating_pow(3), 64);"
"assert_eq!(0_u128.saturating_pow(0), 1);"
"assert_eq!(u128::MAX.saturating_pow(2), u128::MAX);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
exp
Self
match self.checked_pow(exp) { Some(x) => x, None => Self::MAX, }
"assert_eq!(200u128.wrapping_add(55), 255);"
"assert_eq!(200u128.wrapping_add(u128::MAX), 199);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::wrapping_add(self, rhs);
"assert_eq!(1u128.wrapping_add_signed(2), 3);"
"assert_eq!(1u128.wrapping_add_signed(-2), u128::MAX);"
"assert_eq!((u128::MAX - 2).wrapping_add_signed(4), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i128
rhs
Self
self.wrapping_add(rhs as Self);
"assert_eq!(100u128.wrapping_sub(100), 0);"
"assert_eq!(100u128.wrapping_sub(u128::MAX), 101);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::wrapping_sub(self, rhs);
"assert_eq!(1u128.wrapping_sub_signed(2), u128::MAX);"
"assert_eq!(1u128.wrapping_sub_signed(-2), 3);"
"assert_eq!((u128::MAX - 2).wrapping_sub_signed(-4), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i128
rhs
Self
self.wrapping_sub(rhs as Self);
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
intrinsics::wrapping_mul(self, rhs);
"assert_eq!(100u128.wrapping_div(10), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self / rhs;
"assert_eq!(100u128.wrapping_div_euclid(10), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self / rhs;
"assert_eq!(100u128.wrapping_rem(10), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self % rhs;
"assert_eq!(100u128.wrapping_rem_euclid(10), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self % rhs;
"assert_eq!(0_u128.wrapping_neg(), 0);"
"assert_eq!(u128::MAX.wrapping_neg(), 1);"
"assert_eq!(13_u128.wrapping_neg(), (!13) + 1);"
"assert_eq!(42_u128.wrapping_neg(), !(42 - 1));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
(0 as u128).wrapping_sub(self);
"assert_eq!(1_u128.wrapping_shl(7), 128);"
"assert_eq!(0b101_u128.wrapping_shl(0), 0b101);"
"assert_eq!(0b101_u128.wrapping_shl(1), 0b1010);"
"assert_eq!(0b101_u128.wrapping_shl(2), 0b10100);"
"assert_eq!(u128::MAX.wrapping_shl(2), u128::MAX - 3);"
"assert_eq!(42_u128.wrapping_shl(128), 42);"
"assert_eq!(42_u128.wrapping_shl(1).wrapping_shl(127), 0);"
"assert_eq!(1_u128.wrapping_shl(128), 1);"
"assert_eq!(5_u128.wrapping_shl(1025), 10);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
unsafe { self.unchecked_shl(rhs & (Self::BITS - 1)) }
"assert_eq!(128_u128.wrapping_shr(7), 1);"
"assert_eq!(0b1010_u128.wrapping_shr(0), 0b1010);"
"assert_eq!(0b1010_u128.wrapping_shr(1), 0b101);"
"assert_eq!(0b1010_u128.wrapping_shr(2), 0b10);"
"assert_eq!(u128::MAX.wrapping_shr(1), i128::MAX.cast_unsigned());"
"assert_eq!(42_u128.wrapping_shr(128), 42);"
"assert_eq!(42_u128.wrapping_shr(1).wrapping_shr(127), 0);"
"assert_eq!(128_u128.wrapping_shr(128), 128);"
"assert_eq!(10_u128.wrapping_shr(1025), 5);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
Self
unsafe { self.unchecked_shr(rhs & (Self::BITS - 1)) }
"assert_eq!(3u128.wrapping_pow(5), 243);"
"assert_eq!(0_u128.wrapping_pow(0), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Self
if exp == 0 { return 1; }
let mut base = self;
let mut acc: Self = 1;
if intrinsics::is_val_statically_known(exp) {
    while exp > 1 {
        if (exp & 1) == 1 { acc = acc.wrapping_mul(base); }
        exp /= 2;
        base = base.wrapping_mul(base);
    }
    acc.wrapping_mul(base)
} else {
    loop {
        if (exp & 1) == 1 {
            acc = acc.wrapping_mul(base);
            if exp == 1 { return acc; }
        }
        exp /= 2;
        base = base.wrapping_mul(base);
    }
}
"assert_eq!(5u128.overflowing_add(2), (7, false));"
"assert_eq!(u128::MAX.overflowing_add(1), (0, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
let (a, b) = intrinsics::add_with_overflow(self as u128, rhs as u128);
(a as Self, b);
"This can be thought of as a 128-bit \"full adder\", in the electronics sense."
"//    3  MAX    (a = 3 \u{d7} 2^128 + 2^128 - 1)"
"// +  5    7    (b = 5 \u{d7} 2^128 + 7)"
"//    9    6    (sum = 9 \u{d7} 2^128 + 6)"
"let (a1, a0): (u128, u128) = (3, u128::MAX);"
"let (b1, b0): (u128, u128) = (5, 7);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
bool
carry
(Self, bool)
let (a, c1) = self.overflowing_add(rhs);
let (b, c2) = a.overflowing_add(carry as u128);
(b, unsafe { intrinsics::disjoint_bitor(c1, c2) });
"assert_eq!(1u128.overflowing_add_signed(2), (3, false));"
"assert_eq!(1u128.overflowing_add_signed(-2), (u128::MAX, true));"
"assert_eq!((u128::MAX - 2).overflowing_add_signed(4), (1, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i128
rhs
(Self, bool)
let (res, overflowed) = self.overflowing_add(rhs as Self);
(res, overflowed ^ (rhs < 0));
"assert_eq!(5u128.overflowing_sub(2), (3, false));"
"assert_eq!(0u128.overflowing_sub(1), (u128::MAX, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
let (a, b) = intrinsics::sub_with_overflow(self as u128, rhs as u128);
(a as Self, b);
"//    9    6    (a = 9 \u{d7} 2^128 + 6)"
"// -  5    7    (b = 5 \u{d7} 2^128 + 7)"
"//    3  MAX    (diff = 3 \u{d7} 2^128 + 2^128 - 1)"
"let (a1, a0): (u128, u128) = (9, 6);"
"let (b1, b0): (u128, u128) = (5, 7);"
"assert_eq!((diff1, diff0), (3, u128::MAX));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
bool
borrow
(Self, bool)
let (a, c1) = self.overflowing_sub(rhs);
let (b, c2) = a.overflowing_sub(borrow as u128);
(b, unsafe { intrinsics::disjoint_bitor(c1, c2) });
"assert_eq!(1u128.overflowing_sub_signed(2), (u128::MAX, true));"
"assert_eq!(1u128.overflowing_sub_signed(-2), (3, false));"
"assert_eq!((u128::MAX - 2).overflowing_sub_signed(-4), (1, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
i128
rhs
(Self, bool)
let (res, overflow) = self.overflowing_sub(rhs as Self);
(res, overflow ^ (rhs < 0));
"assert_eq!(100u128.abs_diff(80), 20u128);"
"assert_eq!(100u128.abs_diff(110), 10u128);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
other
Self
if size_of::<Self>() == 1 {
    (self as i32).wrapping_sub(other as i32).unsigned_abs() as Self
} else { if self < other { other - self } else { self - other } }
"this returns the result of the operation, \
                          without modifying the original"
Self
self
Self
rhs
(Self, bool)
let (a, b) = intrinsics::mul_with_overflow(self as u128, rhs as u128);
(a as Self, b);
"assert_eq!(5_u128.widening_mul(7), (35, 0));"
"assert_eq!(u128::MAX.widening_mul(u128::MAX), (1, u128::MAX - 1));"
"assert_eq!(u128::widening_mul(1 << 127, 6), (0, 3));"
"assert_eq!(u128::overflowing_mul(1 << 127, 6), (0, true));"
"assert_eq!(u128::wrapping_mul(1 << 127, 6), 0);"
"assert_eq!(u128::checked_mul(1 << 127, 6), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, Self)
Self::carrying_mul_add(self, rhs, 0, 0);
"assert_eq!(u128::MAX.carrying_mul(u128::MAX, u128::MAX), (0, u128::MAX));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
carry
(Self, Self)
Self::carrying_mul_add(self, rhs, carry, 0);
"assert_eq!(u128::MAX.carrying_mul_add(u128::MAX, u128::MAX, u128::MAX), (u128::MAX, u128::MAX));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
carry
Self
add
(Self, Self)
intrinsics::carrying_mul_add(self, rhs, carry, add);
"assert_eq!(5u128.overflowing_div(2), (2, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
(self / rhs, false);
"assert_eq!(5u128.overflowing_div_euclid(2), (2, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
(self / rhs, false);
"assert_eq!(5u128.overflowing_rem(2), (1, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
(self % rhs, false);
"assert_eq!(5u128.overflowing_rem_euclid(2), (1, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
(Self, bool)
(self % rhs, false);
"assert_eq!(0u128.overflowing_neg(), (0, false));"
"assert_eq!(2u128.overflowing_neg(), (-2i32 as u128, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
(Self, bool)
((!self).wrapping_add(1), self != 0);
"assert_eq!(0x1u128.overflowing_shl(4), (0x10, false));"
"assert_eq!(0x1u128.overflowing_shl(132), (0x10, true));"
"assert_eq!(0x10u128.overflowing_shl(127), (0, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
(Self, bool)
(self.wrapping_shl(rhs), rhs >= Self::BITS);
"assert_eq!(0x10u128.overflowing_shr(4), (0x1, false));"
"assert_eq!(0x10u128.overflowing_shr(132), (0x1, true));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
rhs
(Self, bool)
(self.wrapping_shr(rhs), rhs >= Self::BITS);
"assert_eq!(3u128.overflowing_pow(5), (243, false));"
"assert_eq!(0_u128.overflowing_pow(0), (1, false));"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
(Self, bool)
if exp == 0 { return (1, false); }
let mut base = self;
let mut acc: Self = 1;
let mut overflown = false;
let mut r;
loop {
    if (exp & 1) == 1 {
        r = acc.overflowing_mul(base);
        if exp == 1 { r.1 |= overflown; return r; }
        acc = r.0;
        overflown |= r.1;
    }
    exp /= 2;
    r = base.overflowing_mul(base);
    base = r.0;
    overflown |= r.1;
}
"assert_eq!(2u128.pow(5), 32);"
"assert_eq!(0_u128.pow(0), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
u32
mut exp
Self
if exp == 0 { return 1; }
let mut base = self;
let mut acc = 1;
if intrinsics::is_val_statically_known(exp) {
    while exp > 1 {
        if (exp & 1) == 1 { acc = acc * base; }
        exp /= 2;
        base = base * base;
    }
    acc * base
} else {
    loop {
        if (exp & 1) == 1 { acc = acc * base; if exp == 1 { return acc; } }
        exp /= 2;
        base = base * base;
    }
}
"assert_eq!(10u128.isqrt(), 3);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
let result = imp::int_sqrt::u128(self as u128) as u128;
unsafe {
    const MAX_RESULT: u128 = imp::int_sqrt::u128(<u128>::MAX) as u128;
    crate::hint::assert_unchecked(result <= MAX_RESULT);
}
result;
"assert_eq!(7u128.div_euclid(4), 1); // or any other integer type"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self / rhs;
"assert_eq!(7u128.rem_euclid(4), 3); // or any other integer type"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self % rhs;
"assert_eq!(7_u128.div_floor(4), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
self / rhs;
"assert_eq!(7_u128.div_ceil(4), 2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
let d = self / rhs;
let r = self % rhs;
if r > 0 { d + 1 } else { d }
"assert_eq!(16_u128.next_multiple_of(8), 16);"
"assert_eq!(23_u128.next_multiple_of(8), 24);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Self
match self % rhs { 0 => self, r => self + (rhs - r), }
"assert_eq!(16_u128.checked_next_multiple_of(8), Some(16));"
"assert_eq!(23_u128.checked_next_multiple_of(8), Some(24));"
"assert_eq!(1_u128.checked_next_multiple_of(0), None);"
"assert_eq!(u128::MAX.checked_next_multiple_of(2), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
rhs
Option<Self>
match match self.checked_rem(rhs) { Some(x) => x, None => return None, } {
    0 => Some(self),
    r => self.checked_add(rhs - r),
}
"assert!(6_u128.is_multiple_of(2));"
"assert!(!5_u128.is_multiple_of(2));"
"assert!(0_u128.is_multiple_of(0));"
"assert!(!6_u128.is_multiple_of(0));"
Self
self
Self
rhs
bool
match rhs { 0 => self == 0, _ => self % rhs == 0, }
"assert!(16u128.is_power_of_two());"
"assert!(!10u128.is_power_of_two());"
Self
self
bool
self.count_ones() == 1;
Self
self
Self
if self <= 1 { return 0; }
let p = self - 1;
let z = unsafe { intrinsics::ctlz_nonzero(p) };
<u128>::MAX >> z;
"assert_eq!(2u128.next_power_of_two(), 2);"
"assert_eq!(3u128.next_power_of_two(), 4);"
"assert_eq!(0u128.next_power_of_two(), 1);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
self.one_less_than_next_power_of_two() + 1;
"assert_eq!(2u128.checked_next_power_of_two(), Some(2));"
"assert_eq!(3u128.checked_next_power_of_two(), Some(4));"
"assert_eq!(u128::MAX.checked_next_power_of_two(), None);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Option<Self>
self.one_less_than_next_power_of_two().checked_add(1);
"assert_eq!(2u128.wrapping_next_power_of_two(), 2);"
"assert_eq!(3u128.wrapping_next_power_of_two(), 4);"
"assert_eq!(u128::MAX.wrapping_next_power_of_two(), 0);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
Self
self.one_less_than_next_power_of_two().wrapping_add(1);
"let bytes = 0x12345678901234567890123456789012u128.to_be_bytes();"
"assert_eq!(bytes, [0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12]);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
self.to_be().to_ne_bytes();
"let bytes = 0x12345678901234567890123456789012u128.to_le_bytes();"
"assert_eq!(bytes, [0x12, 0x90, 0x78, 0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
self.to_le().to_ne_bytes();
"let bytes = 0x12345678901234567890123456789012u128.to_ne_bytes();"
"        [0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12]"
"        [0x12, 0x90, 0x78, 0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
unsafe { mem::transmute(self) }
"let value = u128::from_be_bytes([0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12]);"
"assert_eq!(value, 0x12345678901234567890123456789012);"
"fn read_be_u128(input: &mut &[u8]) -> u128 {"
"    let (int_bytes, rest) = input.split_at(size_of::<u128>());"
"    u128::from_be_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
Self::from_be(Self::from_ne_bytes(bytes));
"let value = u128::from_le_bytes([0x12, 0x90, 0x78, 0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]);"
"assert_eq!(value, 0x12345678901234567890123456789012);"
"fn read_le_u128(input: &mut &[u8]) -> u128 {"
"    let (int_bytes, rest) = input.split_at(size_of::<u128>());"
"    u128::from_le_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
Self::from_le(Self::from_ne_bytes(bytes));
"let value = u128::from_ne_bytes(if cfg!(target_endian = \"big\") {"
"    [0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12]"
"    [0x12, 0x90, 0x78, 0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]"
"assert_eq!(value, 0x12345678901234567890123456789012);"
"fn read_ne_u128(input: &mut &[u8]) -> u128 {"
"    let (int_bytes, rest) = input.split_at(size_of::<u128>());"
"    u128::from_ne_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
unsafe { mem::transmute(bytes) }
"[`u128::MIN`] instead."
"u128_legacy_fn_min_value"
Self
Self::MIN;
"[`u128::MAX`] instead."
"u128_legacy_fn_max_value"
Self
Self::MAX;
"assert_eq!(120u8, 120u128.truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Target
traits::TruncateTarget::internal_truncate(self);
"assert_eq!(120u8, 120u128.saturating_truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Target
traits::TruncateTarget::internal_saturating_truncate(self);
"assert_eq!(Some(120u8), 120u128.checked_truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Option<Target>
traits::TruncateTarget::internal_checked_truncate(self);
"assert_eq!(120u128, 120u8.extend());"
"this returns the extended value and does not modify the original"
Self
Target
Self
self
Target
traits::ExtendTarget::internal_extend(self);uint_impl! {
1302        Self = u128,
1303        ActualT = u128,
1304        SignedT = i128,
1305        BITS = 128,
1306        BITS_MINUS_ONE = 127,
1307        MAX = 340282366920938463463374607431768211455,
1308        rot = 16,
1309        rot_op = "0x13f40000000000000000000000004f76",
1310        rot_result = "0x4f7613f4",
1311        fsh_op = "0x2fe78e45983acd98039000008736273",
1312        fshl_result = "0x4f7602fe",
1313        fshr_result = "0x4f7602fe78e45983acd9803900000873",
1314        clmul_lhs = "0x12345678901234567890123456789012",
1315        clmul_rhs = "0x4317e40ab4ddcf05dd358416f52ecd34",
1316        clmul_result = "0xb9cf660de35d0c170a6299579b980928",
1317        swap_op = "0x12345678901234567890123456789012",
1318        swapped = "0x12907856341290785634129078563412",
1319        reversed = "0x48091e6a2c48091e6a2c48091e6a2c48",
1320        le_bytes = "[0x12, 0x90, 0x78, 0x56, 0x34, 0x12, 0x90, 0x78, \
1321            0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
1322        be_bytes = "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, \
1323            0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12]",
1324        to_xe_bytes_doc = "",
1325        from_xe_bytes_doc = "",
1326        bound_condition = "",
1327    }
1328    "assert_eq!(0u128.midpoint(4), 2);"
"assert_eq!(1u128.midpoint(4), 2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
((self ^ rhs) >> 1) + (self & rhs);midpoint_impl! { u128, unsigned }
1329    self
Self
rhs
Self
carry
(Self, Self)
let x0 = self as u64;
let x1 = (self >> 64) as u64;
let y0 = rhs as u64;
let y1 = (rhs >> 64) as u64;
let z0 = u64::widening_carryless_mul(x0, y0);
let z2 = u64::widening_carryless_mul(x1, y1);
let z3 = u64::widening_carryless_mul(x0 ^ x1, y0 ^ y1);
let z1 = z3 ^ z0 ^ z2;
let lo = z0 ^ (z1 << 64);
let hi = z2 ^ (z1 >> 64);
(lo ^ carry, hi);carrying_carryless_mul_impl! { u128, u256 }
1330}
1331
1332#[cfg(target_pointer_width = "16")]
1333impl usize {
1334    uint_impl! {
1335        Self = usize,
1336        ActualT = u16,
1337        SignedT = isize,
1338        BITS = 16,
1339        BITS_MINUS_ONE = 15,
1340        MAX = 65535,
1341        rot = 4,
1342        rot_op = "0xa003",
1343        rot_result = "0x3a",
1344        fsh_op = "0x2de",
1345        fshl_result = "0x30",
1346        fshr_result = "0x302d",
1347        clmul_lhs = "0x9012",
1348        clmul_rhs = "0xcd34",
1349        clmul_result = "0x928",
1350        swap_op = "0x1234",
1351        swapped = "0x3412",
1352        reversed = "0x2c48",
1353        le_bytes = "[0x34, 0x12]",
1354        be_bytes = "[0x12, 0x34]",
1355        to_xe_bytes_doc = usize_isize_to_xe_bytes_doc!(),
1356        from_xe_bytes_doc = usize_isize_from_xe_bytes_doc!(),
1357        bound_condition = " on 16-bit targets",
1358    }
1359    midpoint_impl! { usize, u32, unsigned }
1360    carrying_carryless_mul_impl! { usize, u32 }
1361}
1362
1363#[cfg(target_pointer_width = "32")]
1364impl usize {
1365    uint_impl! {
1366        Self = usize,
1367        ActualT = u32,
1368        SignedT = isize,
1369        BITS = 32,
1370        BITS_MINUS_ONE = 31,
1371        MAX = 4294967295,
1372        rot = 8,
1373        rot_op = "0x10000b3",
1374        rot_result = "0xb301",
1375        fsh_op = "0x2fe78e45",
1376        fshl_result = "0xb32f",
1377        fshr_result = "0xb32fe78e",
1378        clmul_lhs = "0x56789012",
1379        clmul_rhs = "0xf52ecd34",
1380        clmul_result = "0x9b980928",
1381        swap_op = "0x12345678",
1382        swapped = "0x78563412",
1383        reversed = "0x1e6a2c48",
1384        le_bytes = "[0x78, 0x56, 0x34, 0x12]",
1385        be_bytes = "[0x12, 0x34, 0x56, 0x78]",
1386        to_xe_bytes_doc = usize_isize_to_xe_bytes_doc!(),
1387        from_xe_bytes_doc = usize_isize_from_xe_bytes_doc!(),
1388        bound_condition = " on 32-bit targets",
1389    }
1390    midpoint_impl! { usize, u64, unsigned }
1391    carrying_carryless_mul_impl! { usize, u64 }
1392}
1393
1394#[cfg(target_pointer_width = "64")]
1395impl usize {
1396    uint_impl! {
1397        Self = usize,
1398        ActualT = u64,
1399        SignedT = isize,
1400        BITS = 64,
1401        BITS_MINUS_ONE = 63,
1402        MAX = 18446744073709551615,
1403        rot = 12,
1404        rot_op = "0xaa00000000006e1",
1405        rot_result = "0x6e10aa",
1406        fsh_op = "0x2fe78e45983acd98",
1407        fshl_result = "0x6e12fe",
1408        fshr_result = "0x6e12fe78e45983ac",
1409        clmul_lhs = "0x7890123456789012",
1410        clmul_rhs = "0xdd358416f52ecd34",
1411        clmul_result = "0xa6299579b980928",
1412        swap_op = "0x1234567890123456",
1413        swapped = "0x5634129078563412",
1414        reversed = "0x6a2c48091e6a2c48",
1415        le_bytes = "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
1416        be_bytes = "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]",
1417        to_xe_bytes_doc = "

**Note**: This function returns an array of length 2, 4 or 8 bytes
depending on the target pointer size.

"
"let bytes = 0x1234567890123456usize.to_ne_bytes();"
"        [0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]"
"        [0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
[u8; size_of::<Self>()]
unsafe { mem::transmute(self) }
"let value = usize::from_be_bytes([0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]);"
"assert_eq!(value, 0x1234567890123456);"
"fn read_be_usize(input: &mut &[u8]) -> usize {"
"    let (int_bytes, rest) = input.split_at(size_of::<usize>());"
"    usize::from_be_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
Self::from_be(Self::from_ne_bytes(bytes));
"let value = usize::from_le_bytes([0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]);"
"assert_eq!(value, 0x1234567890123456);"
"fn read_le_usize(input: &mut &[u8]) -> usize {"
"    let (int_bytes, rest) = input.split_at(size_of::<usize>());"
"    usize::from_le_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
Self::from_le(Self::from_ne_bytes(bytes));
"let value = usize::from_ne_bytes(if cfg!(target_endian = \"big\") {"
"    [0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]"
"    [0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]"
"assert_eq!(value, 0x1234567890123456);"
"fn read_ne_usize(input: &mut &[u8]) -> usize {"
"    let (int_bytes, rest) = input.split_at(size_of::<usize>());"
"    usize::from_ne_bytes(int_bytes.try_into().unwrap())"
[u8; size_of::<Self>()]
bytes
Self
unsafe { mem::transmute(bytes) }
"[`usize::MIN`] instead."
"usize_legacy_fn_min_value"
Self
Self::MIN;
"[`usize::MAX`] instead."
"usize_legacy_fn_max_value"
Self
Self::MAX;
"assert_eq!(120u8, 120usize.truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Target
traits::TruncateTarget::internal_truncate(self);
"assert_eq!(120u8, 120usize.saturating_truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Target
traits::TruncateTarget::internal_saturating_truncate(self);
"assert_eq!(Some(120u8), 120usize.checked_truncate());"
"this returns the truncated value and does not modify the original"
Self
Target
Self
self
Option<Target>
traits::TruncateTarget::internal_checked_truncate(self);
"assert_eq!(120u128, 120u8.extend());"
"this returns the extended value and does not modify the original"
Self
Target
Self
self
Target
traits::ExtendTarget::internal_extend(self);usize_isize_to_xe_bytes_doc!(),
1418        from_xe_bytes_doc = "

**Note**: This function takes an array of length 2, 4 or 8 bytes
depending on the target pointer size.

"usize_isize_from_xe_bytes_doc!(),
1419        bound_condition = " on 64-bit targets",
1420    }
1421    "assert_eq!(0usize.midpoint(4), 2);"
"assert_eq!(1usize.midpoint(4), 2);"
"this returns the result of the operation, \
                      without modifying the original"
Self
self
rhs
((self as u128 + rhs as u128) / 2) as usize;midpoint_impl! { usize, u128, unsigned }
1422    self
Self
rhs
Self
carry
(Self, Self)
let p = (self as u128).carryless_mul(rhs as u128);
let lo = (p as usize);
let hi = (p >> Self::BITS) as usize;
(lo ^ carry, hi);carrying_carryless_mul_impl! { usize, u128 }
1423}
1424
1425impl usize {
1426    /// Returns an `usize` where every byte is equal to `x`.
1427    #[inline]
1428    pub(crate) const fn repeat_u8(x: u8) -> usize {
1429        usize::from_ne_bytes([x; size_of::<usize>()])
1430    }
1431
1432    /// Returns an `usize` where every byte pair is equal to `x`.
1433    #[inline]
1434    pub(crate) const fn repeat_u16(x: u16) -> usize {
1435        let mut r = 0usize;
1436        let mut i = 0;
1437        while i < size_of::<usize>() {
1438            // Use `wrapping_shl` to make it work on targets with 16-bit `usize`
1439            r = r.wrapping_shl(16) | (x as usize);
1440            i += 2;
1441        }
1442        r
1443    }
1444}
1445
1446/// A classification of floating point numbers.
1447///
1448/// This `enum` is used as the return type for [`f32::classify`] and [`f64::classify`]. See
1449/// their documentation for more.
1450///
1451/// # Examples
1452///
1453/// ```
1454/// use std::num::FpCategory;
1455///
1456/// let num = 12.4_f32;
1457/// let inf = f32::INFINITY;
1458/// let zero = 0f32;
1459/// let sub: f32 = 1.1754942e-38;
1460/// let nan = f32::NAN;
1461///
1462/// assert_eq!(num.classify(), FpCategory::Normal);
1463/// assert_eq!(inf.classify(), FpCategory::Infinite);
1464/// assert_eq!(zero.classify(), FpCategory::Zero);
1465/// assert_eq!(sub.classify(), FpCategory::Subnormal);
1466/// assert_eq!(nan.classify(), FpCategory::Nan);
1467/// ```
1468#[derive(#[automatically_derived]
#[stable(feature = "rust1", since = "1.0.0")]
impl crate::marker::Copy for FpCategory { }Copy, #[automatically_derived]
#[stable(feature = "rust1", since = "1.0.0")]
impl crate::clone::Clone for FpCategory {
    #[inline]
    fn clone(&self) -> FpCategory { *self }
}Clone, #[automatically_derived]
#[stable(feature = "rust1", since = "1.0.0")]
impl crate::cmp::PartialEq for FpCategory {
    #[inline]
    fn eq(&self, other: &FpCategory) -> bool {
        let __self_discr = crate::intrinsics::discriminant_value(self);
        let __arg1_discr = crate::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
#[stable(feature = "rust1", since = "1.0.0")]
impl crate::cmp::Eq for FpCategory {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
#[stable(feature = "rust1", since = "1.0.0")]
impl crate::fmt::Debug for FpCategory {
    #[inline]
    fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result {
        crate::fmt::Formatter::write_str(f,
            match self {
                FpCategory::Nan => "Nan",
                FpCategory::Infinite => "Infinite",
                FpCategory::Zero => "Zero",
                FpCategory::Subnormal => "Subnormal",
                FpCategory::Normal => "Normal",
            })
    }
}Debug)]
1469#[stable(feature = "rust1", since = "1.0.0")]
1470pub enum FpCategory {
1471    /// NaN (not a number): this value results from calculations like `(-1.0).sqrt()`.
1472    ///
1473    /// See [the documentation for `f32`](f32) for more information on the unusual properties
1474    /// of NaN.
1475    #[stable(feature = "rust1", since = "1.0.0")]
1476    Nan,
1477
1478    /// Positive or negative infinity, which often results from dividing a nonzero number
1479    /// by zero.
1480    #[stable(feature = "rust1", since = "1.0.0")]
1481    Infinite,
1482
1483    /// Positive or negative zero.
1484    ///
1485    /// See [the documentation for `f32`](f32) for more information on the signedness of zeroes.
1486    #[stable(feature = "rust1", since = "1.0.0")]
1487    Zero,
1488
1489    /// “Subnormal” or “denormal” floating point representation (less precise, relative to
1490    /// their magnitude, than [`Normal`]).
1491    ///
1492    /// Subnormal numbers are larger in magnitude than [`Zero`] but smaller in magnitude than all
1493    /// [`Normal`] numbers.
1494    ///
1495    /// [`Normal`]: Self::Normal
1496    /// [`Zero`]: Self::Zero
1497    #[stable(feature = "rust1", since = "1.0.0")]
1498    Subnormal,
1499
1500    /// A regular floating point number, not any of the exceptional categories.
1501    ///
1502    /// The smallest positive normal numbers are [`f32::MIN_POSITIVE`] and [`f64::MIN_POSITIVE`],
1503    /// and the largest positive normal numbers are [`f32::MAX`] and [`f64::MAX`]. (Unlike signed
1504    /// integers, floating point numbers are symmetric in their range, so negating any of these
1505    /// constants will produce their negative counterpart.)
1506    #[stable(feature = "rust1", since = "1.0.0")]
1507    Normal,
1508}
1509
1510/// Determines if a string of text of that length of that radix could be guaranteed to be
1511/// stored in the given type T.
1512/// Note that if the radix is known to the compiler, it is just the check of digits.len that
1513/// is done at runtime.
1514#[doc(hidden)]
1515#[inline(always)]
1516#[unstable(issue = "none", feature = "std_internals")]
1517pub const fn can_not_overflow<T>(radix: u32, is_signed_ty: bool, digits: &[u8]) -> bool {
1518    radix <= 16 && digits.len() <= size_of::<T>() * 2 - is_signed_ty as usize
1519}
1520
1521#[cfg_attr(not(panic = "immediate-abort"), inline(never))]
1522#[cfg_attr(panic = "immediate-abort", inline)]
1523#[cold]
1524#[track_caller]
1525const fn from_ascii_radix_panic(radix: u32) -> ! {
1526    {
    #[rustc_allow_const_fn_unstable(const_eval_select)]
    #[inline(always)]
    #[track_caller]
    const fn do_panic(radix: u32) -> ! {
        {
            #[inline]
            #[track_caller]
            fn runtime(radix: u32) -> ! {
                {
                    {
                        crate::panicking::panic_fmt(format_args!("from_ascii_radix: radix must lie in the range `[2, 36]` - found {0}",
                                radix));
                    }
                }
            }
            #[inline]
            #[track_caller]
            const fn compiletime(radix: u32) -> ! {
                let _ = radix;
                {
                    {
                        crate::panicking::panic_fmt(format_args!("from_ascii_radix: radix must lie in the range `[2, 36]`"));
                    }
                }
            }
            const_eval_select((radix,), compiletime, runtime)
        }
    }
    do_panic(radix)
}const_panic!(
1527        "from_ascii_radix: radix must lie in the range `[2, 36]`",
1528        "from_ascii_radix: radix must lie in the range `[2, 36]` - found {radix}",
1529        radix: u32 = radix,
1530    )
1531}
1532
1533macro_rules! from_str_int_impl {
1534    ($signedness:ident $($int_ty:ty)+) => {$(
1535        #[stable(feature = "rust1", since = "1.0.0")]
1536        #[rustc_const_unstable(feature = "const_convert", issue = "143773")]
1537        impl const FromStr for $int_ty {
1538            type Err = ParseIntError;
1539
1540            /// Parses an integer from a string slice with decimal digits.
1541            ///
1542            /// The characters are expected to be an optional
1543            #[doc = sign_dependent_expr!{
1544                $signedness ?
1545                if signed {
1546                    " `+` or `-` "
1547                }
1548                if unsigned {
1549                    " `+` "
1550                }
1551            }]
1552            /// sign followed by only digits. Leading and trailing non-digit characters (including
1553            /// whitespace) represent an error. Underscores (which are accepted in Rust literals)
1554            /// also represent an error.
1555            ///
1556            /// # See also
1557            /// For parsing numbers in other bases, such as binary or hexadecimal,
1558            /// see [`from_str_radix`][Self::from_str_radix].
1559            ///
1560            /// # Examples
1561            ///
1562            /// ```
1563            /// use std::str::FromStr;
1564            ///
1565            #[doc = concat!("assert_eq!(", stringify!($int_ty), "::from_str(\"+10\"), Ok(10));")]
1566            /// ```
1567            /// Trailing space returns error:
1568            /// ```
1569            /// # use std::str::FromStr;
1570            /// #
1571            #[doc = concat!("assert!(", stringify!($int_ty), "::from_str(\"1 \").is_err());")]
1572            /// ```
1573            #[inline]
1574            fn from_str(src: &str) -> Result<$int_ty, ParseIntError> {
1575                <$int_ty>::from_str_radix(src, 10)
1576            }
1577        }
1578
1579        impl $int_ty {
1580            /// Parses an integer from a string slice with digits in a given base.
1581            ///
1582            /// The string is expected to be an optional
1583            #[doc = sign_dependent_expr!{
1584                $signedness ?
1585                if signed {
1586                    " `+` or `-` "
1587                }
1588                if unsigned {
1589                    " `+` "
1590                }
1591            }]
1592            /// sign followed by only digits. Leading and trailing non-digit characters (including
1593            /// whitespace) represent an error. Underscores (which are accepted in Rust literals)
1594            /// also represent an error.
1595            ///
1596            /// Digits are a subset of these characters, depending on `radix`:
1597            /// * `0-9`
1598            /// * `a-z`
1599            /// * `A-Z`
1600            ///
1601            /// # Panics
1602            ///
1603            /// This function panics if `radix` is not in the range from 2 to 36.
1604            ///
1605            /// # See also
1606            /// If the string to be parsed is in base 10 (decimal),
1607            /// [`from_str`] or [`str::parse`] can also be used.
1608            ///
1609            // FIXME(#122566): These HTML links work around a rustdoc-json test failure.
1610            /// [`from_str`]: #method.from_str
1611            /// [`str::parse`]: primitive.str.html#method.parse
1612            ///
1613            /// # Examples
1614            ///
1615            /// ```
1616            #[doc = concat!("assert_eq!(", stringify!($int_ty), "::from_str_radix(\"A\", 16), Ok(10));")]
1617            /// ```
1618            /// Trailing space returns error:
1619            /// ```
1620            #[doc = concat!("assert!(", stringify!($int_ty), "::from_str_radix(\"1 \", 10).is_err());")]
1621            /// ```
1622            #[stable(feature = "rust1", since = "1.0.0")]
1623            #[rustc_const_stable(feature = "const_int_from_str", since = "1.82.0")]
1624            #[inline]
1625            pub const fn from_str_radix(src: &str, radix: u32) -> Result<$int_ty, ParseIntError> {
1626                <$int_ty>::from_ascii_radix(src.as_bytes(), radix)
1627            }
1628
1629            /// Parses an integer from an ASCII-byte slice with decimal digits.
1630            ///
1631            /// The characters are expected to be an optional
1632            #[doc = sign_dependent_expr!{
1633                $signedness ?
1634                if signed {
1635                    " `+` or `-` "
1636                }
1637                if unsigned {
1638                    " `+` "
1639                }
1640            }]
1641            /// sign followed by only digits. Leading and trailing non-digit characters (including
1642            /// whitespace) represent an error. Underscores (which are accepted in Rust literals)
1643            /// also represent an error.
1644            ///
1645            /// # Examples
1646            ///
1647            /// ```
1648            /// #![feature(int_from_ascii)]
1649            ///
1650            #[doc = concat!("assert_eq!(", stringify!($int_ty), "::from_ascii(b\"+10\"), Ok(10));")]
1651            /// ```
1652            /// Trailing space returns error:
1653            /// ```
1654            /// # #![feature(int_from_ascii)]
1655            /// #
1656            #[doc = concat!("assert!(", stringify!($int_ty), "::from_ascii(b\"1 \").is_err());")]
1657            /// ```
1658            #[unstable(feature = "int_from_ascii", issue = "134821")]
1659            #[inline]
1660            pub const fn from_ascii(src: &[u8]) -> Result<$int_ty, ParseIntError> {
1661                <$int_ty>::from_ascii_radix(src, 10)
1662            }
1663
1664            /// Parses an integer from an ASCII-byte slice with digits in a given base.
1665            ///
1666            /// The characters are expected to be an optional
1667            #[doc = sign_dependent_expr!{
1668                $signedness ?
1669                if signed {
1670                    " `+` or `-` "
1671                }
1672                if unsigned {
1673                    " `+` "
1674                }
1675            }]
1676            /// sign followed by only digits. Leading and trailing non-digit characters (including
1677            /// whitespace) represent an error. Underscores (which are accepted in Rust literals)
1678            /// also represent an error.
1679            ///
1680            /// Digits are a subset of these characters, depending on `radix`:
1681            /// * `0-9`
1682            /// * `a-z`
1683            /// * `A-Z`
1684            ///
1685            /// # Panics
1686            ///
1687            /// This function panics if `radix` is not in the range from 2 to 36.
1688            ///
1689            /// # Examples
1690            ///
1691            /// ```
1692            /// #![feature(int_from_ascii)]
1693            ///
1694            #[doc = concat!("assert_eq!(", stringify!($int_ty), "::from_ascii_radix(b\"A\", 16), Ok(10));")]
1695            /// ```
1696            /// Trailing space returns error:
1697            /// ```
1698            /// # #![feature(int_from_ascii)]
1699            /// #
1700            #[doc = concat!("assert!(", stringify!($int_ty), "::from_ascii_radix(b\"1 \", 10).is_err());")]
1701            /// ```
1702            #[unstable(feature = "int_from_ascii", issue = "134821")]
1703            #[inline]
1704            pub const fn from_ascii_radix(src: &[u8], radix: u32) -> Result<$int_ty, ParseIntError> {
1705                use self::IntErrorKind::*;
1706                use self::ParseIntError as PIE;
1707
1708                if 2 > radix || radix > 36 {
1709                    from_ascii_radix_panic(radix);
1710                }
1711
1712                if src.is_empty() {
1713                    return Err(PIE { kind: Empty });
1714                }
1715
1716                #[allow(unused_comparisons)]
1717                let is_signed_ty = 0 > <$int_ty>::MIN;
1718
1719                let (is_positive, mut digits) = match src {
1720                    [b'+' | b'-'] => {
1721                        return Err(PIE { kind: InvalidDigit });
1722                    }
1723                    [b'+', rest @ ..] => (true, rest),
1724                    [b'-', rest @ ..] if is_signed_ty => (false, rest),
1725                    _ => (true, src),
1726                };
1727
1728                let mut result = 0;
1729
1730                macro_rules! unwrap_or_PIE {
1731                    ($option:expr, $kind:ident) => {
1732                        match $option {
1733                            Some(value) => value,
1734                            None => return Err(PIE { kind: $kind }),
1735                        }
1736                    };
1737                }
1738
1739                if can_not_overflow::<$int_ty>(radix, is_signed_ty, digits) {
1740                    // If the len of the str is short compared to the range of the type
1741                    // we are parsing into, then we can be certain that an overflow will not occur.
1742                    // This bound is when `radix.pow(digits.len()) - 1 <= T::MAX` but the condition
1743                    // above is a faster (conservative) approximation of this.
1744                    //
1745                    // Consider radix 16 as it has the highest information density per digit and will thus overflow the earliest:
1746                    // `u8::MAX` is `ff` - any str of len 2 is guaranteed to not overflow.
1747                    // `i8::MAX` is `7f` - only a str of len 1 is guaranteed to not overflow.
1748                    macro_rules! run_unchecked_loop {
1749                        ($unchecked_additive_op:tt) => {{
1750                            while let [c, rest @ ..] = digits {
1751                                result = result * (radix as $int_ty);
1752                                let x = unwrap_or_PIE!((*c as char).to_digit(radix), InvalidDigit);
1753                                result = result $unchecked_additive_op (x as $int_ty);
1754                                digits = rest;
1755                            }
1756                        }};
1757                    }
1758                    if is_positive {
1759                        run_unchecked_loop!(+)
1760                    } else {
1761                        run_unchecked_loop!(-)
1762                    };
1763                } else {
1764                    macro_rules! run_checked_loop {
1765                        ($checked_additive_op:ident, $overflow_err:ident) => {{
1766                            while let [c, rest @ ..] = digits {
1767                                // When `radix` is passed in as a literal, rather than doing a slow `imul`
1768                                // the compiler can use shifts if `radix` can be expressed as a
1769                                // sum of powers of 2 (x*10 can be written as x*8 + x*2).
1770                                // When the compiler can't use these optimisations,
1771                                // the latency of the multiplication can be hidden by issuing it
1772                                // before the result is needed to improve performance on
1773                                // modern out-of-order CPU as multiplication here is slower
1774                                // than the other instructions, we can get the end result faster
1775                                // doing multiplication first and let the CPU spends other cycles
1776                                // doing other computation and get multiplication result later.
1777                                let mul = result.checked_mul(radix as $int_ty);
1778                                let x = unwrap_or_PIE!((*c as char).to_digit(radix), InvalidDigit) as $int_ty;
1779                                result = unwrap_or_PIE!(mul, $overflow_err);
1780                                result = unwrap_or_PIE!(<$int_ty>::$checked_additive_op(result, x), $overflow_err);
1781                                digits = rest;
1782                            }
1783                        }};
1784                    }
1785                    if is_positive {
1786                        run_checked_loop!(checked_add, PosOverflow)
1787                    } else {
1788                        run_checked_loop!(checked_sub, NegOverflow)
1789                    };
1790                }
1791                Ok(result)
1792            }
1793        }
1794    )*}
1795}
1796
1797#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
impl const FromStr for i128 {
    type Err = ParseIntError;
    /// Parses an integer from a string slice with decimal digits.
    ///
    /// The characters are expected to be an optional
    #[doc = " `+` or `-` "]
    /// sign followed by only digits. Leading and trailing non-digit characters (including
    /// whitespace) represent an error. Underscores (which are accepted in Rust literals)
    /// also represent an error.
    ///
    /// # See also
    /// For parsing numbers in other bases, such as binary or hexadecimal,
    /// see [`from_str_radix`][Self::from_str_radix].
    ///
    /// # Examples
    ///
    /// ```
    /// use std::str::FromStr;
    ///
    #[doc = "assert_eq!(i128::from_str(\"+10\"), Ok(10));"]
    /// ```
    /// Trailing space returns error:
    /// ```
    /// # use std::str::FromStr;
    /// #
    #[doc = "assert!(i128::from_str(\"1 \").is_err());"]
    /// ```
    #[inline]
    fn from_str(src: &str) -> Result<i128, ParseIntError> {
        <i128>::from_str_radix(src, 10)
    }
}
impl i128 {
    /// Parses an integer from a string slice with digits in a given base.
    ///
    /// The string is expected to be an optional
    #[doc = " `+` or `-` "]
    /// sign followed by only digits. Leading and trailing non-digit characters (including
    /// whitespace) represent an error. Underscores (which are accepted in Rust literals)
    /// also represent an error.
    ///
    /// Digits are a subset of these characters, depending on `radix`:
    /// * `0-9`
    /// * `a-z`
    /// * `A-Z`
    ///
    /// # Panics
    ///
    /// This function panics if `radix` is not in the range from 2 to 36.
    ///
    /// # See also
    /// If the string to be parsed is in base 10 (decimal),
    /// [`from_str`] or [`str::parse`] can also be used.
    ///
    /// [`from_str`]: #method.from_str
    /// [`str::parse`]: primitive.str.html#method.parse
    ///
    /// # Examples
    ///
    /// ```
    #[doc = "assert_eq!(i128::from_str_radix(\"A\", 16), Ok(10));"]
    /// ```
    /// Trailing space returns error:
    /// ```
    #[doc = "assert!(i128::from_str_radix(\"1 \", 10).is_err());"]
    /// ```
    #[stable(feature = "rust1", since = "1.0.0")]
    #[rustc_const_stable(feature = "const_int_from_str", since = "1.82.0")]
    #[inline]
    pub const fn from_str_radix(src: &str, radix: u32)
        -> Result<i128, ParseIntError> {
        <i128>::from_ascii_radix(src.as_bytes(), radix)
    }
    /// Parses an integer from an ASCII-byte slice with decimal digits.
    ///
    /// The characters are expected to be an optional
    #[doc = " `+` or `-` "]
    /// sign followed by only digits. Leading and trailing non-digit characters (including
    /// whitespace) represent an error. Underscores (which are accepted in Rust literals)
    /// also represent an error.
    ///
    /// # Examples
    ///
    /// ```
    /// #![feature(int_from_ascii)]
    ///
    #[doc = "assert_eq!(i128::from_ascii(b\"+10\"), Ok(10));"]
    /// ```
    /// Trailing space returns error:
    /// ```
    /// # #![feature(int_from_ascii)]
    /// #
    #[doc = "assert!(i128::from_ascii(b\"1 \").is_err());"]
    /// ```
    #[unstable(feature = "int_from_ascii", issue = "134821")]
    #[inline]
    pub const fn from_ascii(src: &[u8]) -> Result<i128, ParseIntError> {
        <i128>::from_ascii_radix(src, 10)
    }
    /// Parses an integer from an ASCII-byte slice with digits in a given base.
    ///
    /// The characters are expected to be an optional
    #[doc = " `+` or `-` "]
    /// sign followed by only digits. Leading and trailing non-digit characters (including
    /// whitespace) represent an error. Underscores (which are accepted in Rust literals)
    /// also represent an error.
    ///
    /// Digits are a subset of these characters, depending on `radix`:
    /// * `0-9`
    /// * `a-z`
    /// * `A-Z`
    ///
    /// # Panics
    ///
    /// This function panics if `radix` is not in the range from 2 to 36.
    ///
    /// # Examples
    ///
    /// ```
    /// #![feature(int_from_ascii)]
    ///
    #[doc = "assert_eq!(i128::from_ascii_radix(b\"A\", 16), Ok(10));"]
    /// ```
    /// Trailing space returns error:
    /// ```
    /// # #![feature(int_from_ascii)]
    /// #
    #[doc = "assert!(i128::from_ascii_radix(b\"1 \", 10).is_err());"]
    /// ```
    #[unstable(feature = "int_from_ascii", issue = "134821")]
    #[inline]
    pub const fn from_ascii_radix(src: &[u8], radix: u32)
        -> Result<i128, ParseIntError> {
        use self::IntErrorKind::*;
        use self::ParseIntError as PIE;
        if 2 > radix || radix > 36 { from_ascii_radix_panic(radix); }
        if src.is_empty() { return Err(PIE { kind: Empty }); }
        #[allow(unused_comparisons)]
        let is_signed_ty = 0 > <i128>::MIN;
        let (is_positive, mut digits) =
            match src {
                [b'+' | b'-'] => { return Err(PIE { kind: InvalidDigit }); }
                [b'+', rest @ ..] => (true, rest),
                [b'-', rest @ ..] if is_signed_ty => (false, rest),
                _ => (true, src),
            };
        let mut result = 0;
        macro_rules! unwrap_or_PIE {
            ($option : expr, $kind : ident) =>
            {
                match $option
                {
                    Some(value) => value, None => return
                    Err(PIE { kind : $kind }),
                }
            };
        }
        if can_not_overflow::<i128>(radix, is_signed_ty, digits) {
            macro_rules! run_unchecked_loop {
                ($unchecked_additive_op : tt) =>
                {{
                        while let [c, rest @ ..] = digits
                        {
                            result = result * (radix as i128); let x = unwrap_or_PIE!
                            ((* c as char).to_digit(radix), InvalidDigit); result =
                            result $unchecked_additive_op(x as i128); digits = rest;
                        }
                    }};
            }
            if is_positive {
                {
                    while let [c, rest @ ..] = digits {
                        result = result * (radix as i128);
                        let x =
                            match (*c as char).to_digit(radix) {
                                Some(value) => value,
                                None => return Err(PIE { kind: InvalidDigit }),
                            };
                        result = result + (x as i128);
                        digits = rest;
                    }
                }
            } else {
                {
                    while let [c, rest @ ..] = digits {
                        result = result * (radix as i128);
                        let x =
                            match (*c as char).to_digit(radix) {
                                Some(value) => value,
                                None => return Err(PIE { kind: InvalidDigit }),
                            };
                        result = result - (x as i128);
                        digits = rest;
                    }
                }
            };
        } else {
            macro_rules! run_checked_loop {
                ($checked_additive_op : ident, $overflow_err : ident) =>
                {{
                        while let [c, rest @ ..] = digits
                        {
                            let mul = result.checked_mul(radix as i128); let x =
                            unwrap_or_PIE! ((* c as char).to_digit(radix), InvalidDigit)
                            as i128; result = unwrap_or_PIE! (mul, $overflow_err);
                            result = unwrap_or_PIE!
                            (< i128 > :: $checked_additive_op(result, x),
                            $overflow_err); digits = rest;
                        }
                    }};
            }
            if is_positive {
                {
                    while let [c, rest @ ..] = digits {
                        let mul = result.checked_mul(radix as i128);
                        let x =
                            match (*c as char).to_digit(radix) {
                                    Some(value) => value,
                                    None => return Err(PIE { kind: InvalidDigit }),
                                } as i128;
                        result =
                            match mul {
                                Some(value) => value,
                                None => return Err(PIE { kind: PosOverflow }),
                            };
                        result =
                            match <i128>::checked_add(result, x) {
                                Some(value) => value,
                                None => return Err(PIE { kind: PosOverflow }),
                            };
                        digits = rest;
                    }
                }
            } else {
                {
                    while let [c, rest @ ..] = digits {
                        let mul = result.checked_mul(radix as i128);
                        let x =
                            match (*c as char).to_digit(radix) {
                                    Some(value) => value,
                                    None => return Err(PIE { kind: InvalidDigit }),
                                } as i128;
                        result =
                            match mul {
                                Some(value) => value,
                                None => return Err(PIE { kind: NegOverflow }),
                            };
                        result =
                            match <i128>::checked_sub(result, x) {
                                Some(value) => value,
                                None => return Err(PIE { kind: NegOverflow }),
                            };
                        digits = rest;
                    }
                }
            };
        }
        Ok(result)
    }
}from_str_int_impl! { signed isize i8 i16 i32 i64 i128 }
1798#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
impl const FromStr for u128 {
    type Err = ParseIntError;
    /// Parses an integer from a string slice with decimal digits.
    ///
    /// The characters are expected to be an optional
    #[doc = " `+` "]
    /// sign followed by only digits. Leading and trailing non-digit characters (including
    /// whitespace) represent an error. Underscores (which are accepted in Rust literals)
    /// also represent an error.
    ///
    /// # See also
    /// For parsing numbers in other bases, such as binary or hexadecimal,
    /// see [`from_str_radix`][Self::from_str_radix].
    ///
    /// # Examples
    ///
    /// ```
    /// use std::str::FromStr;
    ///
    #[doc = "assert_eq!(u128::from_str(\"+10\"), Ok(10));"]
    /// ```
    /// Trailing space returns error:
    /// ```
    /// # use std::str::FromStr;
    /// #
    #[doc = "assert!(u128::from_str(\"1 \").is_err());"]
    /// ```
    #[inline]
    fn from_str(src: &str) -> Result<u128, ParseIntError> {
        <u128>::from_str_radix(src, 10)
    }
}
impl u128 {
    /// Parses an integer from a string slice with digits in a given base.
    ///
    /// The string is expected to be an optional
    #[doc = " `+` "]
    /// sign followed by only digits. Leading and trailing non-digit characters (including
    /// whitespace) represent an error. Underscores (which are accepted in Rust literals)
    /// also represent an error.
    ///
    /// Digits are a subset of these characters, depending on `radix`:
    /// * `0-9`
    /// * `a-z`
    /// * `A-Z`
    ///
    /// # Panics
    ///
    /// This function panics if `radix` is not in the range from 2 to 36.
    ///
    /// # See also
    /// If the string to be parsed is in base 10 (decimal),
    /// [`from_str`] or [`str::parse`] can also be used.
    ///
    /// [`from_str`]: #method.from_str
    /// [`str::parse`]: primitive.str.html#method.parse
    ///
    /// # Examples
    ///
    /// ```
    #[doc = "assert_eq!(u128::from_str_radix(\"A\", 16), Ok(10));"]
    /// ```
    /// Trailing space returns error:
    /// ```
    #[doc = "assert!(u128::from_str_radix(\"1 \", 10).is_err());"]
    /// ```
    #[stable(feature = "rust1", since = "1.0.0")]
    #[rustc_const_stable(feature = "const_int_from_str", since = "1.82.0")]
    #[inline]
    pub const fn from_str_radix(src: &str, radix: u32)
        -> Result<u128, ParseIntError> {
        <u128>::from_ascii_radix(src.as_bytes(), radix)
    }
    /// Parses an integer from an ASCII-byte slice with decimal digits.
    ///
    /// The characters are expected to be an optional
    #[doc = " `+` "]
    /// sign followed by only digits. Leading and trailing non-digit characters (including
    /// whitespace) represent an error. Underscores (which are accepted in Rust literals)
    /// also represent an error.
    ///
    /// # Examples
    ///
    /// ```
    /// #![feature(int_from_ascii)]
    ///
    #[doc = "assert_eq!(u128::from_ascii(b\"+10\"), Ok(10));"]
    /// ```
    /// Trailing space returns error:
    /// ```
    /// # #![feature(int_from_ascii)]
    /// #
    #[doc = "assert!(u128::from_ascii(b\"1 \").is_err());"]
    /// ```
    #[unstable(feature = "int_from_ascii", issue = "134821")]
    #[inline]
    pub const fn from_ascii(src: &[u8]) -> Result<u128, ParseIntError> {
        <u128>::from_ascii_radix(src, 10)
    }
    /// Parses an integer from an ASCII-byte slice with digits in a given base.
    ///
    /// The characters are expected to be an optional
    #[doc = " `+` "]
    /// sign followed by only digits. Leading and trailing non-digit characters (including
    /// whitespace) represent an error. Underscores (which are accepted in Rust literals)
    /// also represent an error.
    ///
    /// Digits are a subset of these characters, depending on `radix`:
    /// * `0-9`
    /// * `a-z`
    /// * `A-Z`
    ///
    /// # Panics
    ///
    /// This function panics if `radix` is not in the range from 2 to 36.
    ///
    /// # Examples
    ///
    /// ```
    /// #![feature(int_from_ascii)]
    ///
    #[doc = "assert_eq!(u128::from_ascii_radix(b\"A\", 16), Ok(10));"]
    /// ```
    /// Trailing space returns error:
    /// ```
    /// # #![feature(int_from_ascii)]
    /// #
    #[doc = "assert!(u128::from_ascii_radix(b\"1 \", 10).is_err());"]
    /// ```
    #[unstable(feature = "int_from_ascii", issue = "134821")]
    #[inline]
    pub const fn from_ascii_radix(src: &[u8], radix: u32)
        -> Result<u128, ParseIntError> {
        use self::IntErrorKind::*;
        use self::ParseIntError as PIE;
        if 2 > radix || radix > 36 { from_ascii_radix_panic(radix); }
        if src.is_empty() { return Err(PIE { kind: Empty }); }
        #[allow(unused_comparisons)]
        let is_signed_ty = 0 > <u128>::MIN;
        let (is_positive, mut digits) =
            match src {
                [b'+' | b'-'] => { return Err(PIE { kind: InvalidDigit }); }
                [b'+', rest @ ..] => (true, rest),
                [b'-', rest @ ..] if is_signed_ty => (false, rest),
                _ => (true, src),
            };
        let mut result = 0;
        macro_rules! unwrap_or_PIE {
            ($option : expr, $kind : ident) =>
            {
                match $option
                {
                    Some(value) => value, None => return
                    Err(PIE { kind : $kind }),
                }
            };
        }
        if can_not_overflow::<u128>(radix, is_signed_ty, digits) {
            macro_rules! run_unchecked_loop {
                ($unchecked_additive_op : tt) =>
                {{
                        while let [c, rest @ ..] = digits
                        {
                            result = result * (radix as u128); let x = unwrap_or_PIE!
                            ((* c as char).to_digit(radix), InvalidDigit); result =
                            result $unchecked_additive_op(x as u128); digits = rest;
                        }
                    }};
            }
            if is_positive {
                {
                    while let [c, rest @ ..] = digits {
                        result = result * (radix as u128);
                        let x =
                            match (*c as char).to_digit(radix) {
                                Some(value) => value,
                                None => return Err(PIE { kind: InvalidDigit }),
                            };
                        result = result + (x as u128);
                        digits = rest;
                    }
                }
            } else {
                {
                    while let [c, rest @ ..] = digits {
                        result = result * (radix as u128);
                        let x =
                            match (*c as char).to_digit(radix) {
                                Some(value) => value,
                                None => return Err(PIE { kind: InvalidDigit }),
                            };
                        result = result - (x as u128);
                        digits = rest;
                    }
                }
            };
        } else {
            macro_rules! run_checked_loop {
                ($checked_additive_op : ident, $overflow_err : ident) =>
                {{
                        while let [c, rest @ ..] = digits
                        {
                            let mul = result.checked_mul(radix as u128); let x =
                            unwrap_or_PIE! ((* c as char).to_digit(radix), InvalidDigit)
                            as u128; result = unwrap_or_PIE! (mul, $overflow_err);
                            result = unwrap_or_PIE!
                            (< u128 > :: $checked_additive_op(result, x),
                            $overflow_err); digits = rest;
                        }
                    }};
            }
            if is_positive {
                {
                    while let [c, rest @ ..] = digits {
                        let mul = result.checked_mul(radix as u128);
                        let x =
                            match (*c as char).to_digit(radix) {
                                    Some(value) => value,
                                    None => return Err(PIE { kind: InvalidDigit }),
                                } as u128;
                        result =
                            match mul {
                                Some(value) => value,
                                None => return Err(PIE { kind: PosOverflow }),
                            };
                        result =
                            match <u128>::checked_add(result, x) {
                                Some(value) => value,
                                None => return Err(PIE { kind: PosOverflow }),
                            };
                        digits = rest;
                    }
                }
            } else {
                {
                    while let [c, rest @ ..] = digits {
                        let mul = result.checked_mul(radix as u128);
                        let x =
                            match (*c as char).to_digit(radix) {
                                    Some(value) => value,
                                    None => return Err(PIE { kind: InvalidDigit }),
                                } as u128;
                        result =
                            match mul {
                                Some(value) => value,
                                None => return Err(PIE { kind: NegOverflow }),
                            };
                        result =
                            match <u128>::checked_sub(result, x) {
                                Some(value) => value,
                                None => return Err(PIE { kind: NegOverflow }),
                            };
                        digits = rest;
                    }
                }
            };
        }
        Ok(result)
    }
}from_str_int_impl! { unsigned usize u8 u16 u32 u64 u128 }
1799
1800macro_rules! impl_sealed {
1801    ($($t:ty)*) => {$(
1802        /// Allows extension traits within `core`.
1803        #[unstable(feature = "sealed", issue = "none")]
1804        impl crate::sealed::Sealed for $t {}
1805    )*}
1806}
1807/// Allows extension traits within `core`.
#[unstable(feature = "sealed", issue = "none")]
impl crate::sealed::Sealed for u128 { }impl_sealed! { isize i8 i16 i32 i64 i128 usize u8 u16 u32 u64 u128 }