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 48 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 50 of file SparseBitVector.h.

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

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