Skip to content

Commit 7b1a960

Browse files
committed
Rename {u,i}N::*exact_sh{l,r} to *sh{l,r}_exact
1 parent 5704ebc commit 7b1a960

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

library/core/src/num/int_macros.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,17 +1425,17 @@ macro_rules! int_impl {
14251425
/// ```
14261426
/// #![feature(exact_bitshifts)]
14271427
///
1428-
#[doc = concat!("assert_eq!(0x1", stringify!($SelfT), ".exact_shl(4), Some(0x10));")]
1429-
#[doc = concat!("assert_eq!(0x1", stringify!($SelfT), ".exact_shl(", stringify!($SelfT), "::BITS - 2), Some(1 << ", stringify!($SelfT), "::BITS - 2));")]
1430-
#[doc = concat!("assert_eq!(0x1", stringify!($SelfT), ".exact_shl(", stringify!($SelfT), "::BITS - 1), None);")]
1431-
#[doc = concat!("assert_eq!((-0x2", stringify!($SelfT), ").exact_shl(", stringify!($SelfT), "::BITS - 2), Some(-0x2 << ", stringify!($SelfT), "::BITS - 2));")]
1432-
#[doc = concat!("assert_eq!((-0x2", stringify!($SelfT), ").exact_shl(", stringify!($SelfT), "::BITS - 1), None);")]
1428+
#[doc = concat!("assert_eq!(0x1", stringify!($SelfT), ".shl_exact(4), Some(0x10));")]
1429+
#[doc = concat!("assert_eq!(0x1", stringify!($SelfT), ".shl_exact(", stringify!($SelfT), "::BITS - 2), Some(1 << ", stringify!($SelfT), "::BITS - 2));")]
1430+
#[doc = concat!("assert_eq!(0x1", stringify!($SelfT), ".shl_exact(", stringify!($SelfT), "::BITS - 1), None);")]
1431+
#[doc = concat!("assert_eq!((-0x2", stringify!($SelfT), ").shl_exact(", stringify!($SelfT), "::BITS - 2), Some(-0x2 << ", stringify!($SelfT), "::BITS - 2));")]
1432+
#[doc = concat!("assert_eq!((-0x2", stringify!($SelfT), ").shl_exact(", stringify!($SelfT), "::BITS - 1), None);")]
14331433
/// ```
14341434
#[unstable(feature = "exact_bitshifts", issue = "144336")]
14351435
#[must_use = "this returns the result of the operation, \
14361436
without modifying the original"]
14371437
#[inline]
1438-
pub const fn exact_shl(self, rhs: u32) -> Option<$SelfT> {
1438+
pub const fn shl_exact(self, rhs: u32) -> Option<$SelfT> {
14391439
if rhs < self.leading_zeros() || rhs < self.leading_ones() {
14401440
// SAFETY: rhs is checked above
14411441
Some(unsafe { self.unchecked_shl(rhs) })
@@ -1452,16 +1452,16 @@ macro_rules! int_impl {
14521452
///
14531453
/// This results in undefined behavior when `rhs >= self.leading_zeros() && rhs >=
14541454
/// self.leading_ones()` i.e. when
1455-
#[doc = concat!("[`", stringify!($SelfT), "::exact_shl`]")]
1455+
#[doc = concat!("[`", stringify!($SelfT), "::shl_exact`]")]
14561456
/// would return `None`.
14571457
#[unstable(feature = "exact_bitshifts", issue = "144336")]
14581458
#[must_use = "this returns the result of the operation, \
14591459
without modifying the original"]
14601460
#[inline]
1461-
pub const unsafe fn unchecked_exact_shl(self, rhs: u32) -> $SelfT {
1461+
pub const unsafe fn unchecked_shl_exact(self, rhs: u32) -> $SelfT {
14621462
assert_unsafe_precondition!(
14631463
check_library_ub,
1464-
concat!(stringify!($SelfT), "::unchecked_exact_shl cannot shift out bits that would change the value of the first bit"),
1464+
concat!(stringify!($SelfT), "::unchecked_shl_exact cannot shift out bits that would change the value of the first bit"),
14651465
(
14661466
zeros: u32 = self.leading_zeros(),
14671467
ones: u32 = self.leading_ones(),
@@ -1605,14 +1605,14 @@ macro_rules! int_impl {
16051605
/// ```
16061606
/// #![feature(exact_bitshifts)]
16071607
///
1608-
#[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".exact_shr(4), Some(0x1));")]
1609-
#[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".exact_shr(5), None);")]
1608+
#[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".shr_exact(4), Some(0x1));")]
1609+
#[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".shr_exact(5), None);")]
16101610
/// ```
16111611
#[unstable(feature = "exact_bitshifts", issue = "144336")]
16121612
#[must_use = "this returns the result of the operation, \
16131613
without modifying the original"]
16141614
#[inline]
1615-
pub const fn exact_shr(self, rhs: u32) -> Option<$SelfT> {
1615+
pub const fn shr_exact(self, rhs: u32) -> Option<$SelfT> {
16161616
if rhs <= self.trailing_zeros() && rhs < <$SelfT>::BITS {
16171617
// SAFETY: rhs is checked above
16181618
Some(unsafe { self.unchecked_shr(rhs) })
@@ -1630,16 +1630,16 @@ macro_rules! int_impl {
16301630
/// This results in undefined behavior when `rhs > self.trailing_zeros() || rhs >=
16311631
#[doc = concat!(stringify!($SelfT), "::BITS`")]
16321632
/// i.e. when
1633-
#[doc = concat!("[`", stringify!($SelfT), "::exact_shr`]")]
1633+
#[doc = concat!("[`", stringify!($SelfT), "::shr_exact`]")]
16341634
/// would return `None`.
16351635
#[unstable(feature = "exact_bitshifts", issue = "144336")]
16361636
#[must_use = "this returns the result of the operation, \
16371637
without modifying the original"]
16381638
#[inline]
1639-
pub const unsafe fn unchecked_exact_shr(self, rhs: u32) -> $SelfT {
1639+
pub const unsafe fn unchecked_shr_exact(self, rhs: u32) -> $SelfT {
16401640
assert_unsafe_precondition!(
16411641
check_library_ub,
1642-
concat!(stringify!($SelfT), "::unchecked_exact_shr cannot shift out non-zero bits"),
1642+
concat!(stringify!($SelfT), "::unchecked_shr_exact cannot shift out non-zero bits"),
16431643
(
16441644
zeros: u32 = self.trailing_zeros(),
16451645
bits: u32 = <$SelfT>::BITS,

library/core/src/num/uint_macros.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1832,14 +1832,14 @@ macro_rules! uint_impl {
18321832
/// ```
18331833
/// #![feature(exact_bitshifts)]
18341834
///
1835-
#[doc = concat!("assert_eq!(0x1", stringify!($SelfT), ".exact_shl(4), Some(0x10));")]
1836-
#[doc = concat!("assert_eq!(0x1", stringify!($SelfT), ".exact_shl(129), None);")]
1835+
#[doc = concat!("assert_eq!(0x1", stringify!($SelfT), ".shl_exact(4), Some(0x10));")]
1836+
#[doc = concat!("assert_eq!(0x1", stringify!($SelfT), ".shl_exact(129), None);")]
18371837
/// ```
18381838
#[unstable(feature = "exact_bitshifts", issue = "144336")]
18391839
#[must_use = "this returns the result of the operation, \
18401840
without modifying the original"]
18411841
#[inline]
1842-
pub const fn exact_shl(self, rhs: u32) -> Option<$SelfT> {
1842+
pub const fn shl_exact(self, rhs: u32) -> Option<$SelfT> {
18431843
if rhs <= self.leading_zeros() && rhs < <$SelfT>::BITS {
18441844
// SAFETY: rhs is checked above
18451845
Some(unsafe { self.unchecked_shl(rhs) })
@@ -1857,16 +1857,16 @@ macro_rules! uint_impl {
18571857
/// This results in undefined behavior when `rhs > self.leading_zeros() || rhs >=
18581858
#[doc = concat!(stringify!($SelfT), "::BITS`")]
18591859
/// i.e. when
1860-
#[doc = concat!("[`", stringify!($SelfT), "::exact_shl`]")]
1860+
#[doc = concat!("[`", stringify!($SelfT), "::shl_exact`]")]
18611861
/// would return `None`.
18621862
#[unstable(feature = "exact_bitshifts", issue = "144336")]
18631863
#[must_use = "this returns the result of the operation, \
18641864
without modifying the original"]
18651865
#[inline]
1866-
pub const unsafe fn unchecked_exact_shl(self, rhs: u32) -> $SelfT {
1866+
pub const unsafe fn unchecked_shl_exact(self, rhs: u32) -> $SelfT {
18671867
assert_unsafe_precondition!(
18681868
check_library_ub,
1869-
concat!(stringify!($SelfT), "::exact_shl_unchecked cannot shift out non-zero bits"),
1869+
concat!(stringify!($SelfT), "::unchecked_shl_exact cannot shift out non-zero bits"),
18701870
(
18711871
zeros: u32 = self.leading_zeros(),
18721872
bits: u32 = <$SelfT>::BITS,
@@ -2004,14 +2004,14 @@ macro_rules! uint_impl {
20042004
/// ```
20052005
/// #![feature(exact_bitshifts)]
20062006
///
2007-
#[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".exact_shr(4), Some(0x1));")]
2008-
#[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".exact_shr(5), None);")]
2007+
#[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".shr_exact(4), Some(0x1));")]
2008+
#[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".shr_exact(5), None);")]
20092009
/// ```
20102010
#[unstable(feature = "exact_bitshifts", issue = "144336")]
20112011
#[must_use = "this returns the result of the operation, \
20122012
without modifying the original"]
20132013
#[inline]
2014-
pub const fn exact_shr(self, rhs: u32) -> Option<$SelfT> {
2014+
pub const fn shr_exact(self, rhs: u32) -> Option<$SelfT> {
20152015
if rhs <= self.trailing_zeros() && rhs < <$SelfT>::BITS {
20162016
// SAFETY: rhs is checked above
20172017
Some(unsafe { self.unchecked_shr(rhs) })
@@ -2029,16 +2029,16 @@ macro_rules! uint_impl {
20292029
/// This results in undefined behavior when `rhs > self.trailing_zeros() || rhs >=
20302030
#[doc = concat!(stringify!($SelfT), "::BITS`")]
20312031
/// i.e. when
2032-
#[doc = concat!("[`", stringify!($SelfT), "::exact_shr`]")]
2032+
#[doc = concat!("[`", stringify!($SelfT), "::shr_exact`]")]
20332033
/// would return `None`.
20342034
#[unstable(feature = "exact_bitshifts", issue = "144336")]
20352035
#[must_use = "this returns the result of the operation, \
20362036
without modifying the original"]
20372037
#[inline]
2038-
pub const unsafe fn unchecked_exact_shr(self, rhs: u32) -> $SelfT {
2038+
pub const unsafe fn unchecked_shr_exact(self, rhs: u32) -> $SelfT {
20392039
assert_unsafe_precondition!(
20402040
check_library_ub,
2041-
concat!(stringify!($SelfT), "::exact_shr_unchecked cannot shift out non-zero bits"),
2041+
concat!(stringify!($SelfT), "::unchecked_shr_exact cannot shift out non-zero bits"),
20422042
(
20432043
zeros: u32 = self.trailing_zeros(),
20442044
bits: u32 = <$SelfT>::BITS,

0 commit comments

Comments
 (0)