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 e2f5f32 commit c9fc3d6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions include/primesieve/popcnt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
#ifndef POPCNT_HPP
#define POPCNT_HPP

#include "macros.hpp"
#include <macros.hpp>
#include <stdint.h>

#if defined(ENABLE_MULTIARCH_x86_POPCNT)
#include "cpu_supports_popcnt.hpp"
#include <cpu_supports_popcnt.hpp>
#endif

// GCC & Clang
Expand Down 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 c9fc3d6

Please sign in to comment.