@@ -2204,7 +2204,7 @@ macro_rules! int_impl {
2204
2204
/// rounded down.
2205
2205
///
2206
2206
/// This method might not be optimized owing to implementation details;
2207
- /// `log2 ` can produce results more efficiently for base 2, and `log10 `
2207
+ /// `ilog2 ` can produce results more efficiently for base 2, and `ilog10 `
2208
2208
/// can produce results more efficiently for base 10.
2209
2209
///
2210
2210
/// # Panics
@@ -2217,7 +2217,7 @@ macro_rules! int_impl {
2217
2217
///
2218
2218
/// ```
2219
2219
/// #![feature(int_log)]
2220
- #[ doc = concat!( "assert_eq!(5" , stringify!( $SelfT) , ".log (5), 1);" ) ]
2220
+ #[ doc = concat!( "assert_eq!(5" , stringify!( $SelfT) , ".ilog (5), 1);" ) ]
2221
2221
/// ```
2222
2222
#[ unstable( feature = "int_log" , issue = "70887" ) ]
2223
2223
#[ must_use = "this returns the result of the operation, \
@@ -2226,8 +2226,8 @@ macro_rules! int_impl {
2226
2226
#[ track_caller]
2227
2227
#[ rustc_inherit_overflow_checks]
2228
2228
#[ allow( arithmetic_overflow) ]
2229
- pub const fn log ( self , base: Self ) -> u32 {
2230
- match self . checked_log ( base) {
2229
+ pub const fn ilog ( self , base: Self ) -> u32 {
2230
+ match self . checked_ilog ( base) {
2231
2231
Some ( n) => n,
2232
2232
None => {
2233
2233
// In debug builds, trigger a panic on None.
@@ -2250,7 +2250,7 @@ macro_rules! int_impl {
2250
2250
///
2251
2251
/// ```
2252
2252
/// #![feature(int_log)]
2253
- #[ doc = concat!( "assert_eq!(2" , stringify!( $SelfT) , ".log2 (), 1);" ) ]
2253
+ #[ doc = concat!( "assert_eq!(2" , stringify!( $SelfT) , ".ilog2 (), 1);" ) ]
2254
2254
/// ```
2255
2255
#[ unstable( feature = "int_log" , issue = "70887" ) ]
2256
2256
#[ must_use = "this returns the result of the operation, \
@@ -2259,8 +2259,8 @@ macro_rules! int_impl {
2259
2259
#[ track_caller]
2260
2260
#[ rustc_inherit_overflow_checks]
2261
2261
#[ allow( arithmetic_overflow) ]
2262
- pub const fn log2 ( self ) -> u32 {
2263
- match self . checked_log2 ( ) {
2262
+ pub const fn ilog2 ( self ) -> u32 {
2263
+ match self . checked_ilog2 ( ) {
2264
2264
Some ( n) => n,
2265
2265
None => {
2266
2266
// In debug builds, trigger a panic on None.
@@ -2283,7 +2283,7 @@ macro_rules! int_impl {
2283
2283
///
2284
2284
/// ```
2285
2285
/// #![feature(int_log)]
2286
- #[ doc = concat!( "assert_eq!(10" , stringify!( $SelfT) , ".log10 (), 1);" ) ]
2286
+ #[ doc = concat!( "assert_eq!(10" , stringify!( $SelfT) , ".ilog10 (), 1);" ) ]
2287
2287
/// ```
2288
2288
#[ unstable( feature = "int_log" , issue = "70887" ) ]
2289
2289
#[ must_use = "this returns the result of the operation, \
@@ -2292,8 +2292,8 @@ macro_rules! int_impl {
2292
2292
#[ track_caller]
2293
2293
#[ rustc_inherit_overflow_checks]
2294
2294
#[ allow( arithmetic_overflow) ]
2295
- pub const fn log10 ( self ) -> u32 {
2296
- match self . checked_log10 ( ) {
2295
+ pub const fn ilog10 ( self ) -> u32 {
2296
+ match self . checked_ilog10 ( ) {
2297
2297
Some ( n) => n,
2298
2298
None => {
2299
2299
// In debug builds, trigger a panic on None.
@@ -2311,20 +2311,20 @@ macro_rules! int_impl {
2311
2311
/// Returns `None` if the number is negative or zero, or if the base is not at least 2.
2312
2312
///
2313
2313
/// This method might not be optimized owing to implementation details;
2314
- /// `checked_log2 ` can produce results more efficiently for base 2, and
2315
- /// `checked_log10 ` can produce results more efficiently for base 10.
2314
+ /// `checked_ilog2 ` can produce results more efficiently for base 2, and
2315
+ /// `checked_ilog10 ` can produce results more efficiently for base 10.
2316
2316
///
2317
2317
/// # Examples
2318
2318
///
2319
2319
/// ```
2320
2320
/// #![feature(int_log)]
2321
- #[ doc = concat!( "assert_eq!(5" , stringify!( $SelfT) , ".checked_log (5), Some(1));" ) ]
2321
+ #[ doc = concat!( "assert_eq!(5" , stringify!( $SelfT) , ".checked_ilog (5), Some(1));" ) ]
2322
2322
/// ```
2323
2323
#[ unstable( feature = "int_log" , issue = "70887" ) ]
2324
2324
#[ must_use = "this returns the result of the operation, \
2325
2325
without modifying the original"]
2326
2326
#[ inline]
2327
- pub const fn checked_log ( self , base: Self ) -> Option <u32 > {
2327
+ pub const fn checked_ilog ( self , base: Self ) -> Option <u32 > {
2328
2328
if self <= 0 || base <= 1 {
2329
2329
None
2330
2330
} else {
@@ -2333,7 +2333,7 @@ macro_rules! int_impl {
2333
2333
2334
2334
// Optimization for 128 bit wide integers.
2335
2335
if Self :: BITS == 128 {
2336
- let b = Self :: log2 ( self ) / ( Self :: log2 ( base) + 1 ) ;
2336
+ let b = Self :: ilog2 ( self ) / ( Self :: ilog2 ( base) + 1 ) ;
2337
2337
n += b;
2338
2338
r /= base. pow( b as u32 ) ;
2339
2339
}
@@ -2354,13 +2354,13 @@ macro_rules! int_impl {
2354
2354
///
2355
2355
/// ```
2356
2356
/// #![feature(int_log)]
2357
- #[ doc = concat!( "assert_eq!(2" , stringify!( $SelfT) , ".checked_log2 (), Some(1));" ) ]
2357
+ #[ doc = concat!( "assert_eq!(2" , stringify!( $SelfT) , ".checked_ilog2 (), Some(1));" ) ]
2358
2358
/// ```
2359
2359
#[ unstable( feature = "int_log" , issue = "70887" ) ]
2360
2360
#[ must_use = "this returns the result of the operation, \
2361
2361
without modifying the original"]
2362
2362
#[ inline]
2363
- pub const fn checked_log2 ( self ) -> Option <u32 > {
2363
+ pub const fn checked_ilog2 ( self ) -> Option <u32 > {
2364
2364
if self <= 0 {
2365
2365
None
2366
2366
} else {
@@ -2378,13 +2378,13 @@ macro_rules! int_impl {
2378
2378
///
2379
2379
/// ```
2380
2380
/// #![feature(int_log)]
2381
- #[ doc = concat!( "assert_eq!(10" , stringify!( $SelfT) , ".checked_log10 (), Some(1));" ) ]
2381
+ #[ doc = concat!( "assert_eq!(10" , stringify!( $SelfT) , ".checked_ilog10 (), Some(1));" ) ]
2382
2382
/// ```
2383
2383
#[ unstable( feature = "int_log" , issue = "70887" ) ]
2384
2384
#[ must_use = "this returns the result of the operation, \
2385
2385
without modifying the original"]
2386
2386
#[ inline]
2387
- pub const fn checked_log10 ( self ) -> Option <u32 > {
2387
+ pub const fn checked_ilog10 ( self ) -> Option <u32 > {
2388
2388
if self > 0 {
2389
2389
Some ( int_log10:: $ActualT( self as $ActualT) )
2390
2390
} else {
0 commit comments