Lines Matching refs:Val

49 countTrailingZeros(T Val, ZeroBehavior ZB = ZB_Width) {
52 if (!Val)
54 if (Val & 0x1)
62 if ((Val & Mask) == 0) {
63 Val >>= Shift;
76 countTrailingZeros(T Val, ZeroBehavior ZB = ZB_Width) LLVM_DELETED_FUNCTION;
80 inline std::size_t countTrailingZeros<uint32_t>(uint32_t Val, ZeroBehavior ZB) {
81 if (ZB != ZB_Undefined && Val == 0)
85 return __builtin_ctz(Val);
88 _BitScanForward(&Index, Val);
95 inline std::size_t countTrailingZeros<uint64_t>(uint64_t Val, ZeroBehavior ZB) {
96 if (ZB != ZB_Undefined && Val == 0)
100 return __builtin_ctzll(Val);
103 _BitScanForward64(&Index, Val);
120 countLeadingZeros(T Val, ZeroBehavior ZB = ZB_Width) {
123 if (!Val)
129 T Tmp = Val >> Shift;
131 Val = Tmp;
142 countLeadingZeros(T Val, ZeroBehavior ZB = ZB_Width) LLVM_DELETED_FUNCTION;
146 inline std::size_t countLeadingZeros<uint32_t>(uint32_t Val, ZeroBehavior ZB) {
147 if (ZB != ZB_Undefined && Val == 0)
151 return __builtin_clz(Val);
154 _BitScanReverse(&Index, Val);
161 inline std::size_t countLeadingZeros<uint64_t>(uint64_t Val, ZeroBehavior ZB) {
162 if (ZB != ZB_Undefined && Val == 0)
166 return __builtin_clzll(Val);
169 _BitScanReverse64(&Index, Val);
186 findFirstSet(T Val, ZeroBehavior ZB = ZB_Max) {
187 if (ZB == ZB_Max && Val == 0)
190 return countTrailingZeros(Val, ZB_Undefined);
197 findFirstSet(T Val, ZeroBehavior ZB = ZB_Max) LLVM_DELETED_FUNCTION;
209 findLastSet(T Val, ZeroBehavior ZB = ZB_Max) {
210 if (ZB == ZB_Max && Val == 0)
215 return countLeadingZeros(Val, ZB_Undefined) ^
223 findLastSet(T Val, ZeroBehavior ZB = ZB_Max) LLVM_DELETED_FUNCTION;
238 /// \brief Reverse the bits in \p Val.
240 T reverseBits(T Val) {
241 unsigned char in[sizeof(Val)];
242 unsigned char out[sizeof(Val)];
243 std::memcpy(in, &Val, sizeof(Val));
244 for (unsigned i = 0; i < sizeof(Val); ++i)
245 out[(sizeof(Val) - i) - 1] = BitReverseTable256[in[i]];
246 std::memcpy(&Val, out, sizeof(Val));
247 return Val;