Skip to content
This repository has been archived by the owner on Jun 11, 2022. It is now read-only.

Commit

Permalink
Use popcount only on x86.
Browse files Browse the repository at this point in the history
  • Loading branch information
qnikst committed Mar 13, 2019
1 parent 43d7197 commit e1d0849
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions imhamt/src/bitmap.rs
Expand Up @@ -61,7 +61,7 @@ impl SmallBitmap {
self.0 == 0 self.0 == 0
} }


#[target_feature(enable = "popcnt")] #[cfg_attr(target_arch = "x86", target_feature(enable = "popcnt"))]
unsafe fn present_fast(&self) -> usize { unsafe fn present_fast(&self) -> usize {
self.0.count_ones() as usize self.0.count_ones() as usize
} }
Expand All @@ -79,7 +79,7 @@ impl SmallBitmap {


/// Get the sparse array index from a level index /// Get the sparse array index from a level index
#[inline] #[inline]
#[target_feature(enable = "popcnt")] #[cfg_attr(target_arch = "x86", target_feature(enable = "popcnt"))]
unsafe fn get_index_sparse_fast(&self, b: LevelIndex) -> ArrayIndex { unsafe fn get_index_sparse_fast(&self, b: LevelIndex) -> ArrayIndex {
let mask = b.mask(); let mask = b.mask();
if self.0 & mask == 0 { if self.0 & mask == 0 {
Expand All @@ -95,7 +95,7 @@ impl SmallBitmap {
} }


#[inline] #[inline]
#[target_feature(enable = "popcnt")] #[cfg_attr(target_arch = "x86", target_feature(enable = "popcnt"))]
unsafe fn get_sparse_pos_fast(&self, b: LevelIndex) -> ArrayIndex { unsafe fn get_sparse_pos_fast(&self, b: LevelIndex) -> ArrayIndex {
let mask = b.mask(); let mask = b.mask();
ArrayIndex::create((self.0 & (mask - 1)).count_ones() as usize) ArrayIndex::create((self.0 & (mask - 1)).count_ones() as usize)
Expand Down

1 comment on commit e1d0849

@gufmar
Copy link

@gufmar gufmar commented on e1d0849 Mar 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this solved critical compilation errors on ARM systems. thanks!

Please sign in to comment.