• Home
  • Raw
  • Download

Lines Matching refs:value

30 inline unsigned CountPopulation32(uint32_t value) {  in CountPopulation32()  argument
32 return __builtin_popcount(value); in CountPopulation32()
34 value = ((value >> 1) & 0x55555555) + (value & 0x55555555); in CountPopulation32()
35 value = ((value >> 2) & 0x33333333) + (value & 0x33333333); in CountPopulation32()
36 value = ((value >> 4) & 0x0f0f0f0f) + (value & 0x0f0f0f0f); in CountPopulation32()
37 value = ((value >> 8) & 0x00ff00ff) + (value & 0x00ff00ff); in CountPopulation32()
38 value = ((value >> 16) & 0x0000ffff) + (value & 0x0000ffff); in CountPopulation32()
39 return static_cast<unsigned>(value); in CountPopulation32()
45 inline unsigned CountPopulation64(uint64_t value) { in CountPopulation64() argument
47 return __builtin_popcountll(value); in CountPopulation64()
49 return CountPopulation32(static_cast<uint32_t>(value)) + in CountPopulation64()
50 CountPopulation32(static_cast<uint32_t>(value >> 32)); in CountPopulation64()
56 inline unsigned CountPopulation(uint32_t value) { in CountPopulation() argument
57 return CountPopulation32(value); in CountPopulation()
61 inline unsigned CountPopulation(uint64_t value) { in CountPopulation() argument
62 return CountPopulation64(value); in CountPopulation()
68 inline unsigned CountLeadingZeros32(uint32_t value) { in CountLeadingZeros32() argument
70 return value ? __builtin_clz(value) : 32; in CountLeadingZeros32()
73 if (!_BitScanReverse(&result, value)) return 32; in CountLeadingZeros32()
76 value = value | (value >> 1); in CountLeadingZeros32()
77 value = value | (value >> 2); in CountLeadingZeros32()
78 value = value | (value >> 4); in CountLeadingZeros32()
79 value = value | (value >> 8); in CountLeadingZeros32()
80 value = value | (value >> 16); in CountLeadingZeros32()
81 return CountPopulation32(~value); in CountLeadingZeros32()
88 inline unsigned CountLeadingZeros64(uint64_t value) { in CountLeadingZeros64() argument
90 return value ? __builtin_clzll(value) : 64; in CountLeadingZeros64()
92 value = value | (value >> 1); in CountLeadingZeros64()
93 value = value | (value >> 2); in CountLeadingZeros64()
94 value = value | (value >> 4); in CountLeadingZeros64()
95 value = value | (value >> 8); in CountLeadingZeros64()
96 value = value | (value >> 16); in CountLeadingZeros64()
97 value = value | (value >> 32); in CountLeadingZeros64()
98 return CountPopulation64(~value); in CountLeadingZeros64()
105 T ReverseBits(T value) { in ReverseBits() argument
106 DCHECK((sizeof(value) == 1) || (sizeof(value) == 2) || (sizeof(value) == 4) || in ReverseBits()
107 (sizeof(value) == 8)); in ReverseBits()
109 for (unsigned i = 0; i < (sizeof(value) * 8); i++) { in ReverseBits()
110 result = (result << 1) | (value & 1); in ReverseBits()
111 value >>= 1; in ReverseBits()
119 inline unsigned CountTrailingZeros32(uint32_t value) { in CountTrailingZeros32() argument
121 return value ? __builtin_ctz(value) : 32; in CountTrailingZeros32()
124 if (!_BitScanForward(&result, value)) return 32; in CountTrailingZeros32()
127 if (value == 0) return 32; in CountTrailingZeros32()
129 for (value ^= value - 1; value >>= 1; ++count) { in CountTrailingZeros32()
139 inline unsigned CountTrailingZeros64(uint64_t value) { in CountTrailingZeros64() argument
141 return value ? __builtin_ctzll(value) : 64; in CountTrailingZeros64()
143 if (value == 0) return 64; in CountTrailingZeros64()
145 for (value ^= value - 1; value >>= 1; ++count) { in CountTrailingZeros64()
152 inline unsigned CountTrailingZeros(uint32_t value) { in CountTrailingZeros() argument
153 return CountTrailingZeros32(value); in CountTrailingZeros()
156 inline unsigned CountTrailingZeros(uint64_t value) { in CountTrailingZeros() argument
157 return CountTrailingZeros64(value); in CountTrailingZeros()
161 inline bool IsPowerOfTwo32(uint32_t value) { in IsPowerOfTwo32() argument
162 return value && !(value & (value - 1)); in IsPowerOfTwo32()
167 inline bool IsPowerOfTwo64(uint64_t value) { in IsPowerOfTwo64() argument
168 return value && !(value & (value - 1)); in IsPowerOfTwo64()
177 V8_BASE_EXPORT uint32_t RoundUpToPowerOfTwo32(uint32_t value);
182 inline uint32_t RoundDownToPowerOfTwo32(uint32_t value) { in RoundDownToPowerOfTwo32() argument
183 if (value > 0x80000000u) return 0x80000000u; in RoundDownToPowerOfTwo32()
184 uint32_t result = RoundUpToPowerOfTwo32(value); in RoundDownToPowerOfTwo32()
185 if (result > value) result >>= 1; in RoundDownToPowerOfTwo32()
191 inline uint32_t RotateRight32(uint32_t value, uint32_t shift) { in RotateRight32() argument
192 if (shift == 0) return value; in RotateRight32()
193 return (value >> shift) | (value << (32 - shift)); in RotateRight32()
197 inline uint32_t RotateLeft32(uint32_t value, uint32_t shift) { in RotateLeft32() argument
198 if (shift == 0) return value; in RotateLeft32()
199 return (value << shift) | (value >> (32 - shift)); in RotateLeft32()
203 inline uint64_t RotateRight64(uint64_t value, uint64_t shift) { in RotateRight64() argument
204 if (shift == 0) return value; in RotateRight64()
205 return (value >> shift) | (value << (64 - shift)); in RotateRight64()
209 inline uint64_t RotateLeft64(uint64_t value, uint64_t shift) { in RotateLeft64() argument
210 if (shift == 0) return value; in RotateLeft64()
211 return (value << shift) | (value >> (64 - shift)); in RotateLeft64()
321 FromCheckedNumeric(const internal::CheckedNumeric<int64_t> value);