Skip to content

Commit

Permalink
Merge branch 'master' into fix/perf_atomic
Browse files Browse the repository at this point in the history
  • Loading branch information
Pratyush authored Oct 17, 2024
2 parents c51999b + 9bd198f commit ab39211
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ pub mod error;
#[doc(hidden)]
pub use std::*;

#[cfg(target_has_atomic = "ptr")]
#[doc(hidden)]
pub mod sync {
#[cfg(not(feature = "std"))]
pub use alloc::sync::*;
#[cfg(feature = "std")]
pub use std::sync::*;
}

mod rand_helper;
pub use rand_helper::*;

Expand All @@ -66,7 +75,8 @@ pub use num_traits::{One, Zero};
/// assert_eq!(log2(1 << 15), 15);
/// assert_eq!(log2(2usize.pow(18)), 18);
/// ```
pub fn log2(x: usize) -> u32 {
#[inline(always)]
pub const fn log2(x: usize) -> u32 {
if x == 0 {
0
} else if x.is_power_of_two() {
Expand Down

0 comments on commit ab39211

Please sign in to comment.