Static Value-Flow Analysis
Static Public Member Functions | List of all members
SVF::PopulationCounter< T, SizeOfT > Struct Template Reference

#include <SparseBitVector.h>

Static Public Member Functions

static unsigned count (T Value)
 

Detailed Description

template<typename T, std::size_t SizeOfT>
struct SVF::PopulationCounter< T, SizeOfT >

Definition at line 127 of file SparseBitVector.h.

Member Function Documentation

◆ count()

template<typename T , std::size_t SizeOfT>
static unsigned SVF::PopulationCounter< T, SizeOfT >::count ( Value)
inlinestatic

Definition at line 129 of file SparseBitVector.h.

130  {
131  // Generic version, forward to 32 bits.
132  static_assert(SizeOfT <= 4, "Not implemented!");
133 #if defined(__GNUC__)
134  return __builtin_popcount(Value);
135 #else
136  uint32_t v = Value;
137  v = v - ((v >> 1) & 0x55555555);
138  v = (v & 0x33333333) + ((v >> 2) & 0x33333333);
139  return ((v + (v >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
140 #endif
141  }
llvm::Value Value
LLVM Basic classes.
Definition: BasicTypes.h:82

The documentation for this struct was generated from the following file: