Skip to content
Permalink
Browse files

Merge pull request #520 from input-output-hk/x86-popcount

Use popcount only on x86.
  • Loading branch information...
NicolasDP committed Mar 13, 2019
2 parents 6a0745a + e1d0849 commit 9aa89b3b69b5a22bd7748bf20b487dcad8dca0ba
Showing with 3 additions and 3 deletions.
  1. +3 −3 imhamt/src/bitmap.rs
@@ -61,7 +61,7 @@ impl SmallBitmap {
self.0 == 0
}

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

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

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

0 comments on commit 9aa89b3

Please sign in to comment.
You can’t perform that action at this time.