Static Value-Flow Analysis
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
SVF::TrailingZerosCounter< T, SizeOfT > Struct Template Reference

#include <SparseBitVector.h>

Static Public Member Functions

static unsigned count (T Val, ZeroBehavior)
 

Detailed Description

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

Definition at line 46 of file SparseBitVector.h.

Member Function Documentation

◆ count()

template<typename T , std::size_t SizeOfT>
static unsigned SVF::TrailingZerosCounter< T, SizeOfT >::count ( T  Val,
ZeroBehavior   
)
inlinestatic

Definition at line 48 of file SparseBitVector.h.

49 {
50 if (!Val)
51 return std::numeric_limits<T>::digits;
52 if (Val & 0x1)
53 return 0;
54
55 // Bisection method.
56 unsigned ZeroBits = 0;
57 T Shift = std::numeric_limits<T>::digits >> 1;
58 T Mask = std::numeric_limits<T>::max() >> Shift;
59 while (Shift)
60 {
61 if ((Val & Mask) == 0)
62 {
63 Val >>= Shift;
64 ZeroBits |= Shift;
65 }
66 Shift >>= 1;
67 Mask >>= Shift;
68 }
69 return ZeroBits;
70 }
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

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