@@ -2204,7 +2204,7 @@ macro_rules! int_impl {
22042204 /// rounded down.
22052205 ///
22062206 /// 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 `
22082208 /// can produce results more efficiently for base 10.
22092209 ///
22102210 /// # Panics
@@ -2217,7 +2217,7 @@ macro_rules! int_impl {
22172217 ///
22182218 /// ```
22192219 /// #![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);" ) ]
22212221 /// ```
22222222 #[ unstable( feature = "int_log" , issue = "70887" ) ]
22232223 #[ must_use = "this returns the result of the operation, \
@@ -2226,8 +2226,8 @@ macro_rules! int_impl {
22262226 #[ track_caller]
22272227 #[ rustc_inherit_overflow_checks]
22282228 #[ 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) {
22312231 Some ( n) => n,
22322232 None => {
22332233 // In debug builds, trigger a panic on None.
@@ -2250,7 +2250,7 @@ macro_rules! int_impl {
22502250 ///
22512251 /// ```
22522252 /// #![feature(int_log)]
2253- #[ doc = concat!( "assert_eq!(2" , stringify!( $SelfT) , ".log2 (), 1);" ) ]
2253+ #[ doc = concat!( "assert_eq!(2" , stringify!( $SelfT) , ".ilog2 (), 1);" ) ]
22542254 /// ```
22552255 #[ unstable( feature = "int_log" , issue = "70887" ) ]
22562256 #[ must_use = "this returns the result of the operation, \
@@ -2259,8 +2259,8 @@ macro_rules! int_impl {
22592259 #[ track_caller]
22602260 #[ rustc_inherit_overflow_checks]
22612261 #[ 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 ( ) {
22642264 Some ( n) => n,
22652265 None => {
22662266 // In debug builds, trigger a panic on None.
@@ -2283,7 +2283,7 @@ macro_rules! int_impl {
22832283 ///
22842284 /// ```
22852285 /// #![feature(int_log)]
2286- #[ doc = concat!( "assert_eq!(10" , stringify!( $SelfT) , ".log10 (), 1);" ) ]
2286+ #[ doc = concat!( "assert_eq!(10" , stringify!( $SelfT) , ".ilog10 (), 1);" ) ]
22872287 /// ```
22882288 #[ unstable( feature = "int_log" , issue = "70887" ) ]
22892289 #[ must_use = "this returns the result of the operation, \
@@ -2292,8 +2292,8 @@ macro_rules! int_impl {
22922292 #[ track_caller]
22932293 #[ rustc_inherit_overflow_checks]
22942294 #[ 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 ( ) {
22972297 Some ( n) => n,
22982298 None => {
22992299 // In debug builds, trigger a panic on None.
@@ -2311,20 +2311,20 @@ macro_rules! int_impl {
23112311 /// Returns `None` if the number is negative or zero, or if the base is not at least 2.
23122312 ///
23132313 /// 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.
23162316 ///
23172317 /// # Examples
23182318 ///
23192319 /// ```
23202320 /// #![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));" ) ]
23222322 /// ```
23232323 #[ unstable( feature = "int_log" , issue = "70887" ) ]
23242324 #[ must_use = "this returns the result of the operation, \
23252325 without modifying the original"]
23262326 #[ inline]
2327- pub const fn checked_log ( self , base: Self ) -> Option <u32 > {
2327+ pub const fn checked_ilog ( self , base: Self ) -> Option <u32 > {
23282328 if self <= 0 || base <= 1 {
23292329 None
23302330 } else {
@@ -2333,7 +2333,7 @@ macro_rules! int_impl {
23332333
23342334 // Optimization for 128 bit wide integers.
23352335 if Self :: BITS == 128 {
2336- let b = Self :: log2 ( self ) / ( Self :: log2 ( base) + 1 ) ;
2336+ let b = Self :: ilog2 ( self ) / ( Self :: ilog2 ( base) + 1 ) ;
23372337 n += b;
23382338 r /= base. pow( b as u32 ) ;
23392339 }
@@ -2354,13 +2354,13 @@ macro_rules! int_impl {
23542354 ///
23552355 /// ```
23562356 /// #![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));" ) ]
23582358 /// ```
23592359 #[ unstable( feature = "int_log" , issue = "70887" ) ]
23602360 #[ must_use = "this returns the result of the operation, \
23612361 without modifying the original"]
23622362 #[ inline]
2363- pub const fn checked_log2 ( self ) -> Option <u32 > {
2363+ pub const fn checked_ilog2 ( self ) -> Option <u32 > {
23642364 if self <= 0 {
23652365 None
23662366 } else {
@@ -2378,13 +2378,13 @@ macro_rules! int_impl {
23782378 ///
23792379 /// ```
23802380 /// #![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));" ) ]
23822382 /// ```
23832383 #[ unstable( feature = "int_log" , issue = "70887" ) ]
23842384 #[ must_use = "this returns the result of the operation, \
23852385 without modifying the original"]
23862386 #[ inline]
2387- pub const fn checked_log10 ( self ) -> Option <u32 > {
2387+ pub const fn checked_ilog10 ( self ) -> Option <u32 > {
23882388 if self > 0 {
23892389 Some ( int_log10:: $ActualT( self as $ActualT) )
23902390 } else {
0 commit comments