Skip to content

Commit eee6f80

Browse files
committed
Renamed isolate_most_least_significant_one functions
libs-api has agreed to rename these functions to `isolate_highest_one`/`isolate_lowest_one`
1 parent 213d946 commit eee6f80

File tree

6 files changed

+38
-38
lines changed

6 files changed

+38
-38
lines changed

library/core/src/num/int_macros.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,14 @@ macro_rules! int_impl {
177177
///
178178
#[doc = concat!("let n: ", stringify!($SelfT), " = 0b_01100100;")]
179179
///
180-
/// assert_eq!(n.isolate_most_significant_one(), 0b_01000000);
181-
#[doc = concat!("assert_eq!(0_", stringify!($SelfT), ".isolate_most_significant_one(), 0);")]
180+
/// assert_eq!(n.isolate_highest_one(), 0b_01000000);
181+
#[doc = concat!("assert_eq!(0_", stringify!($SelfT), ".isolate_highest_one(), 0);")]
182182
/// ```
183183
#[unstable(feature = "isolate_most_least_significant_one", issue = "136909")]
184184
#[must_use = "this returns the result of the operation, \
185185
without modifying the original"]
186186
#[inline(always)]
187-
pub const fn isolate_most_significant_one(self) -> Self {
187+
pub const fn isolate_highest_one(self) -> Self {
188188
self & (((1 as $SelfT) << (<$SelfT>::BITS - 1)).wrapping_shr(self.leading_zeros()))
189189
}
190190

@@ -198,14 +198,14 @@ macro_rules! int_impl {
198198
///
199199
#[doc = concat!("let n: ", stringify!($SelfT), " = 0b_01100100;")]
200200
///
201-
/// assert_eq!(n.isolate_least_significant_one(), 0b_00000100);
202-
#[doc = concat!("assert_eq!(0_", stringify!($SelfT), ".isolate_least_significant_one(), 0);")]
201+
/// assert_eq!(n.isolate_lowest_one(), 0b_00000100);
202+
#[doc = concat!("assert_eq!(0_", stringify!($SelfT), ".isolate_lowest_one(), 0);")]
203203
/// ```
204204
#[unstable(feature = "isolate_most_least_significant_one", issue = "136909")]
205205
#[must_use = "this returns the result of the operation, \
206206
without modifying the original"]
207207
#[inline(always)]
208-
pub const fn isolate_least_significant_one(self) -> Self {
208+
pub const fn isolate_lowest_one(self) -> Self {
209209
self & self.wrapping_neg()
210210
}
211211

library/core/src/num/nonzero.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -629,15 +629,15 @@ macro_rules! nonzero_integer {
629629
#[doc = concat!("let a = NonZero::<", stringify!($Int), ">::new(0b_01100100)?;")]
630630
#[doc = concat!("let b = NonZero::<", stringify!($Int), ">::new(0b_01000000)?;")]
631631
///
632-
/// assert_eq!(a.isolate_most_significant_one(), b);
632+
/// assert_eq!(a.isolate_highest_one(), b);
633633
/// # Some(())
634634
/// # }
635635
/// ```
636636
#[unstable(feature = "isolate_most_least_significant_one", issue = "136909")]
637637
#[must_use = "this returns the result of the operation, \
638638
without modifying the original"]
639639
#[inline(always)]
640-
pub const fn isolate_most_significant_one(self) -> Self {
640+
pub const fn isolate_highest_one(self) -> Self {
641641
let n = self.get() & (((1 as $Int) << (<$Int>::BITS - 1)).wrapping_shr(self.leading_zeros()));
642642

643643
// SAFETY:
@@ -659,15 +659,15 @@ macro_rules! nonzero_integer {
659659
#[doc = concat!("let a = NonZero::<", stringify!($Int), ">::new(0b_01100100)?;")]
660660
#[doc = concat!("let b = NonZero::<", stringify!($Int), ">::new(0b_00000100)?;")]
661661
///
662-
/// assert_eq!(a.isolate_least_significant_one(), b);
662+
/// assert_eq!(a.isolate_lowest_one(), b);
663663
/// # Some(())
664664
/// # }
665665
/// ```
666666
#[unstable(feature = "isolate_most_least_significant_one", issue = "136909")]
667667
#[must_use = "this returns the result of the operation, \
668668
without modifying the original"]
669669
#[inline(always)]
670-
pub const fn isolate_least_significant_one(self) -> Self {
670+
pub const fn isolate_lowest_one(self) -> Self {
671671
let n = self.get();
672672
let n = n & n.wrapping_neg();
673673

library/core/src/num/uint_macros.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,14 +229,14 @@ macro_rules! uint_impl {
229229
///
230230
#[doc = concat!("let n: ", stringify!($SelfT), " = 0b_01100100;")]
231231
///
232-
/// assert_eq!(n.isolate_most_significant_one(), 0b_01000000);
233-
#[doc = concat!("assert_eq!(0_", stringify!($SelfT), ".isolate_most_significant_one(), 0);")]
232+
/// assert_eq!(n.isolate_highest_one(), 0b_01000000);
233+
#[doc = concat!("assert_eq!(0_", stringify!($SelfT), ".isolate_highest_one(), 0);")]
234234
/// ```
235235
#[unstable(feature = "isolate_most_least_significant_one", issue = "136909")]
236236
#[must_use = "this returns the result of the operation, \
237237
without modifying the original"]
238238
#[inline(always)]
239-
pub const fn isolate_most_significant_one(self) -> Self {
239+
pub const fn isolate_highest_one(self) -> Self {
240240
self & (((1 as $SelfT) << (<$SelfT>::BITS - 1)).wrapping_shr(self.leading_zeros()))
241241
}
242242

@@ -250,14 +250,14 @@ macro_rules! uint_impl {
250250
///
251251
#[doc = concat!("let n: ", stringify!($SelfT), " = 0b_01100100;")]
252252
///
253-
/// assert_eq!(n.isolate_least_significant_one(), 0b_00000100);
254-
#[doc = concat!("assert_eq!(0_", stringify!($SelfT), ".isolate_least_significant_one(), 0);")]
253+
/// assert_eq!(n.isolate_lowest_one(), 0b_00000100);
254+
#[doc = concat!("assert_eq!(0_", stringify!($SelfT), ".isolate_lowest_one(), 0);")]
255255
/// ```
256256
#[unstable(feature = "isolate_most_least_significant_one", issue = "136909")]
257257
#[must_use = "this returns the result of the operation, \
258258
without modifying the original"]
259259
#[inline(always)]
260-
pub const fn isolate_least_significant_one(self) -> Self {
260+
pub const fn isolate_lowest_one(self) -> Self {
261261
self & self.wrapping_neg()
262262
}
263263

library/coretests/tests/nonzero.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ fn nonzero_trailing_zeros() {
321321
}
322322

323323
#[test]
324-
fn test_nonzero_isolate_most_significant_one() {
324+
fn test_nonzero_isolate_highest_one() {
325325
// Signed most significant one
326326
macro_rules! nonzero_int_impl {
327327
($($T:ty),+) => {
@@ -335,8 +335,8 @@ fn test_nonzero_isolate_most_significant_one() {
335335
let mut i = 0;
336336
while i < <$T>::BITS {
337337
assert_eq!(
338-
NonZero::<$T>::new(BITS >> i).unwrap().isolate_most_significant_one(),
339-
NonZero::<$T>::new(MOST_SIG_ONE >> i).unwrap().isolate_most_significant_one()
338+
NonZero::<$T>::new(BITS >> i).unwrap().isolate_highest_one(),
339+
NonZero::<$T>::new(MOST_SIG_ONE >> i).unwrap().isolate_highest_one()
340340
);
341341
i += 1;
342342
}
@@ -356,8 +356,8 @@ fn test_nonzero_isolate_most_significant_one() {
356356
let mut i = 0;
357357
while i < <$T>::BITS {
358358
assert_eq!(
359-
NonZero::<$T>::new(BITS >> i).unwrap().isolate_most_significant_one(),
360-
NonZero::<$T>::new(MOST_SIG_ONE >> i).unwrap().isolate_most_significant_one(),
359+
NonZero::<$T>::new(BITS >> i).unwrap().isolate_highest_one(),
360+
NonZero::<$T>::new(MOST_SIG_ONE >> i).unwrap().isolate_highest_one(),
361361
);
362362
i += 1;
363363
}
@@ -371,7 +371,7 @@ fn test_nonzero_isolate_most_significant_one() {
371371
}
372372

373373
#[test]
374-
fn test_nonzero_isolate_least_significant_one() {
374+
fn test_nonzero_isolate_lowest_one() {
375375
// Signed least significant one
376376
macro_rules! nonzero_int_impl {
377377
($($T:ty),+) => {
@@ -385,8 +385,8 @@ fn test_nonzero_isolate_least_significant_one() {
385385
let mut i = 0;
386386
while i < <$T>::BITS {
387387
assert_eq!(
388-
NonZero::<$T>::new(BITS << i).unwrap().isolate_least_significant_one(),
389-
NonZero::<$T>::new(LEAST_SIG_ONE << i).unwrap().isolate_least_significant_one()
388+
NonZero::<$T>::new(BITS << i).unwrap().isolate_lowest_one(),
389+
NonZero::<$T>::new(LEAST_SIG_ONE << i).unwrap().isolate_lowest_one()
390390
);
391391
i += 1;
392392
}
@@ -406,8 +406,8 @@ fn test_nonzero_isolate_least_significant_one() {
406406
let mut i = 0;
407407
while i < <$T>::BITS {
408408
assert_eq!(
409-
NonZero::<$T>::new(BITS << i).unwrap().isolate_least_significant_one(),
410-
NonZero::<$T>::new(LEAST_SIG_ONE << i).unwrap().isolate_least_significant_one(),
409+
NonZero::<$T>::new(BITS << i).unwrap().isolate_lowest_one(),
410+
NonZero::<$T>::new(LEAST_SIG_ONE << i).unwrap().isolate_lowest_one(),
411411
);
412412
i += 1;
413413
}

library/coretests/tests/num/int_macros.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ macro_rules! int_module {
194194
}
195195

196196
#[test]
197-
fn test_isolate_most_significant_one() {
197+
fn test_isolate_highest_one() {
198198
const BITS: $T = -1;
199199
const MOST_SIG_ONE: $T = 1 << (<$T>::BITS - 1);
200200

@@ -203,15 +203,15 @@ macro_rules! int_module {
203203
let mut i = 0;
204204
while i < <$T>::BITS {
205205
assert_eq!(
206-
(BITS >> i).isolate_most_significant_one(),
207-
(MOST_SIG_ONE >> i).isolate_most_significant_one()
206+
(BITS >> i).isolate_highest_one(),
207+
(MOST_SIG_ONE >> i).isolate_highest_one()
208208
);
209209
i += 1;
210210
}
211211
}
212212

213213
#[test]
214-
fn test_isolate_least_significant_one() {
214+
fn test_isolate_lowest_one() {
215215
const BITS: $T = -1;
216216
const LEAST_SIG_ONE: $T = 1;
217217

@@ -220,8 +220,8 @@ macro_rules! int_module {
220220
let mut i = 0;
221221
while i < <$T>::BITS {
222222
assert_eq!(
223-
(BITS << i).isolate_least_significant_one(),
224-
(LEAST_SIG_ONE << i).isolate_least_significant_one()
223+
(BITS << i).isolate_lowest_one(),
224+
(LEAST_SIG_ONE << i).isolate_lowest_one()
225225
);
226226
i += 1;
227227
}

library/coretests/tests/num/uint_macros.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ macro_rules! uint_module {
151151
}
152152

153153
#[test]
154-
fn test_isolate_most_significant_one() {
154+
fn test_isolate_highest_one() {
155155
const BITS: $T = <$T>::MAX;
156156
const MOST_SIG_ONE: $T = 1 << (<$T>::BITS - 1);
157157

@@ -160,15 +160,15 @@ macro_rules! uint_module {
160160
let mut i = 0;
161161
while i < <$T>::BITS {
162162
assert_eq!(
163-
(BITS >> i).isolate_most_significant_one(),
164-
(MOST_SIG_ONE >> i).isolate_most_significant_one(),
163+
(BITS >> i).isolate_highest_one(),
164+
(MOST_SIG_ONE >> i).isolate_highest_one(),
165165
);
166166
i += 1;
167167
}
168168
}
169169

170170
#[test]
171-
fn test_isolate_least_significant_one() {
171+
fn test_isolate_lowest_one() {
172172
const BITS: $T = <$T>::MAX;
173173
const LEAST_SIG_ONE: $T = 1;
174174

@@ -177,8 +177,8 @@ macro_rules! uint_module {
177177
let mut i = 0;
178178
while i < <$T>::BITS {
179179
assert_eq!(
180-
(BITS << i).isolate_least_significant_one(),
181-
(LEAST_SIG_ONE << i).isolate_least_significant_one(),
180+
(BITS << i).isolate_lowest_one(),
181+
(LEAST_SIG_ONE << i).isolate_lowest_one(),
182182
);
183183
i += 1;
184184
}

0 commit comments

Comments
 (0)