Skip to content

Commit

Permalink
Revert
Browse files Browse the repository at this point in the history
  • Loading branch information
kimwalisch committed Jul 2, 2024
1 parent 93e7b09 commit 2f51cf0
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions include/Sieve.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,20 +127,17 @@ class Sieve
/// Count 1 bits inside [start, stop]
ALWAYS_INLINE uint64_t count(uint64_t start, uint64_t stop) const
{
if (start > stop)
return 0;

#if defined(ENABLE_ARM_SVE)
return count_arm_sve(start, stop);
#elif defined(ENABLE_AVX512_BMI2)
return count_avx512_bmi2(start, stop);
#elif defined(ENABLE_MULTIARCH_ARM_SVE)
return cpu_supports_sve ? count_arm_sve(start, stop) : count_default(start, stop);
#elif defined(ENABLE_MULTIARCH_AVX512_BMI2)
return cpu_supports_avx512_bmi2 ? count_avx512_bmi2(start, stop) : count_default(start, stop);
#else
return count_default(start, stop);
#endif
#if defined(ENABLE_ARM_SVE)
return count_arm_sve(start, stop);
#elif defined(ENABLE_AVX512_BMI2)
return count_avx512_bmi2(start, stop);
#elif defined(ENABLE_MULTIARCH_ARM_SVE)
return cpu_supports_sve ? count_arm_sve(start, stop) : count_default(start, stop);
#elif defined(ENABLE_MULTIARCH_AVX512_BMI2)
return cpu_supports_avx512_bmi2 ? count_avx512_bmi2(start, stop) : count_default(start, stop);
#else
return count_default(start, stop);
#endif
}

private:
Expand All @@ -154,7 +151,9 @@ class Sieve
///
uint64_t count_default(uint64_t start, uint64_t stop) const
{
ASSERT(start <= stop);
if (start > stop)
return 0;

ASSERT(stop - start < segment_size());
uint64_t start_idx = start / 240;
uint64_t stop_idx = stop / 240;
Expand Down Expand Up @@ -189,7 +188,9 @@ class Sieve
#endif
uint64_t count_avx512_bmi2(uint64_t start, uint64_t stop) const
{
ASSERT(start <= stop);
if (start > stop)
return 0;

ASSERT(stop - start < segment_size());
uint64_t start_idx = start / 240;
uint64_t stop_idx = stop / 240;
Expand Down Expand Up @@ -240,7 +241,9 @@ class Sieve
#endif
uint64_t count_arm_sve(uint64_t start, uint64_t stop) const
{
ASSERT(start <= stop);
if (start > stop)
return 0;

ASSERT(stop - start < segment_size());
uint64_t start_idx = start / 240;
uint64_t stop_idx = stop / 240;
Expand Down

0 comments on commit 2f51cf0

Please sign in to comment.