Skip to content

Commit

Permalink
Get rid of if_unlikely()
Browse files Browse the repository at this point in the history
  • Loading branch information
kimwalisch committed Jul 11, 2024
1 parent 9100e57 commit 5f54093
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions include/PiTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class PiTable : public BitSieve240
{
ASSERT(x <= max_x_);

if_unlikely(x < pi_tiny_.size())
if (x < pi_tiny_.size())
return pi_tiny_[x];

uint64_t count = pi_[x / 240].count;
Expand All @@ -58,7 +58,7 @@ class PiTable : public BitSieve240
/// Get number of primes <= x
static int64_t pi_cache(uint64_t x)
{
if_unlikely(x < pi_tiny_.size())
if (x < pi_tiny_.size())
return pi_tiny_[x];

uint64_t count = pi_cache_[x / 240].count;
Expand Down
2 changes: 1 addition & 1 deletion include/SegmentedPiTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class SegmentedPiTable : public BitSieve240
ASSERT(x >= low_);
ASSERT(x < high_);

if_unlikely(x < pi_tiny_.size())
if (x < pi_tiny_.size())
return pi_tiny_[x];

x -= low_;
Expand Down
8 changes: 4 additions & 4 deletions include/popcnt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ ALWAYS_INLINE uint64_t popcnt64(uint64_t x)
{
// On my AMD EPYC 7642 CPU using GCC 12 this runtime
// check incurs an overall overhead of about 1%.
if_likely(cpu_supports_popcnt)
if (cpu_supports_popcnt)
{
__asm__("popcnt %1, %0" : "=r"(x) : "r"(x));
return x;
Expand Down Expand Up @@ -89,7 +89,7 @@ NOINLINE uint64_t popcnt64_bitwise(uint64_t x)

ALWAYS_INLINE uint64_t popcnt64(uint64_t x)
{
if_likely(cpu_supports_popcnt)
if (cpu_supports_popcnt)
{
uint32_t x0 = uint32_t(x);
uint32_t x1 = uint32_t(x >> 32);
Expand Down Expand Up @@ -166,7 +166,7 @@ NOINLINE uint64_t popcnt64_bitwise(uint64_t x)

ALWAYS_INLINE uint64_t popcnt64(uint64_t x)
{
if_likely(cpu_supports_popcnt)
if (cpu_supports_popcnt)
return __popcnt64(x);
else
return popcnt64_bitwise(x);
Expand Down Expand Up @@ -237,7 +237,7 @@ NOINLINE uint64_t popcnt64_bitwise(uint64_t x)

ALWAYS_INLINE uint64_t popcnt64(uint64_t x)
{
if_likely(cpu_supports_popcnt)
if (cpu_supports_popcnt)
return __popcnt(uint32_t(x)) +
__popcnt(uint32_t(x >> 32));
else
Expand Down

0 comments on commit 5f54093

Please sign in to comment.