@@ -135,22 +135,22 @@ template <typename T> T reverseBits(T Val) {
135
135
// ambiguity.
136
136
137
137
// / Return the high 32 bits of a 64 bit value.
138
- constexpr inline uint32_t Hi_32 (uint64_t Value) {
138
+ constexpr uint32_t Hi_32 (uint64_t Value) {
139
139
return static_cast <uint32_t >(Value >> 32 );
140
140
}
141
141
142
142
// / Return the low 32 bits of a 64 bit value.
143
- constexpr inline uint32_t Lo_32 (uint64_t Value) {
143
+ constexpr uint32_t Lo_32 (uint64_t Value) {
144
144
return static_cast <uint32_t >(Value);
145
145
}
146
146
147
147
// / Make a 64-bit integer from a high / low pair of 32-bit integers.
148
- constexpr inline uint64_t Make_64 (uint32_t High, uint32_t Low) {
148
+ constexpr uint64_t Make_64 (uint32_t High, uint32_t Low) {
149
149
return ((uint64_t )High << 32 ) | (uint64_t )Low;
150
150
}
151
151
152
152
// / Checks if an integer fits into the given bit width.
153
- template <unsigned N> constexpr inline bool isInt (int64_t x) {
153
+ template <unsigned N> constexpr bool isInt (int64_t x) {
154
154
if constexpr (N == 0 )
155
155
return 0 == x;
156
156
if constexpr (N == 8 )
@@ -167,14 +167,14 @@ template <unsigned N> constexpr inline bool isInt(int64_t x) {
167
167
168
168
// / Checks if a signed integer is an N bit number shifted left by S.
169
169
template <unsigned N, unsigned S>
170
- constexpr inline bool isShiftedInt (int64_t x) {
170
+ constexpr bool isShiftedInt (int64_t x) {
171
171
static_assert (S < 64 , " isShiftedInt<N, S> with S >= 64 is too much." );
172
172
static_assert (N + S <= 64 , " isShiftedInt<N, S> with N + S > 64 is too wide." );
173
173
return isInt<N + S>(x) && (x % (UINT64_C (1 ) << S) == 0 );
174
174
}
175
175
176
176
// / Checks if an unsigned integer fits into the given bit width.
177
- template <unsigned N> constexpr inline bool isUInt (uint64_t x) {
177
+ template <unsigned N> constexpr bool isUInt (uint64_t x) {
178
178
if constexpr (N == 0 )
179
179
return 0 == x;
180
180
if constexpr (N == 8 )
@@ -191,7 +191,7 @@ template <unsigned N> constexpr inline bool isUInt(uint64_t x) {
191
191
192
192
// / Checks if a unsigned integer is an N bit number shifted left by S.
193
193
template <unsigned N, unsigned S>
194
- constexpr inline bool isShiftedUInt (uint64_t x) {
194
+ constexpr bool isShiftedUInt (uint64_t x) {
195
195
static_assert (S < 64 , " isShiftedUInt<N, S> with S >= 64 is too much." );
196
196
static_assert (N + S <= 64 ,
197
197
" isShiftedUInt<N, S> with N + S > 64 is too wide." );
@@ -248,36 +248,36 @@ inline bool isIntN(unsigned N, int64_t x) {
248
248
// / Return true if the argument is a non-empty sequence of ones starting at the
249
249
// / least significant bit with the remainder zero (32 bit version).
250
250
// / Ex. isMask_32(0x0000FFFFU) == true.
251
- constexpr inline bool isMask_32 (uint32_t Value) {
251
+ constexpr bool isMask_32 (uint32_t Value) {
252
252
return Value && ((Value + 1 ) & Value) == 0 ;
253
253
}
254
254
255
255
// / Return true if the argument is a non-empty sequence of ones starting at the
256
256
// / least significant bit with the remainder zero (64 bit version).
257
- constexpr inline bool isMask_64 (uint64_t Value) {
257
+ constexpr bool isMask_64 (uint64_t Value) {
258
258
return Value && ((Value + 1 ) & Value) == 0 ;
259
259
}
260
260
261
261
// / Return true if the argument contains a non-empty sequence of ones with the
262
262
// / remainder zero (32 bit version.) Ex. isShiftedMask_32(0x0000FF00U) == true.
263
- constexpr inline bool isShiftedMask_32 (uint32_t Value) {
263
+ constexpr bool isShiftedMask_32 (uint32_t Value) {
264
264
return Value && isMask_32 ((Value - 1 ) | Value);
265
265
}
266
266
267
267
// / Return true if the argument contains a non-empty sequence of ones with the
268
268
// / remainder zero (64 bit version.)
269
- constexpr inline bool isShiftedMask_64 (uint64_t Value) {
269
+ constexpr bool isShiftedMask_64 (uint64_t Value) {
270
270
return Value && isMask_64 ((Value - 1 ) | Value);
271
271
}
272
272
273
273
// / Return true if the argument is a power of two > 0.
274
274
// / Ex. isPowerOf2_32(0x00100000U) == true (32 bit edition.)
275
- constexpr inline bool isPowerOf2_32 (uint32_t Value) {
275
+ constexpr bool isPowerOf2_32 (uint32_t Value) {
276
276
return llvm::has_single_bit (Value);
277
277
}
278
278
279
279
// / Return true if the argument is a power of two > 0 (64 bit edition.)
280
- constexpr inline bool isPowerOf2_64 (uint64_t Value) {
280
+ constexpr bool isPowerOf2_64 (uint64_t Value) {
281
281
return llvm::has_single_bit (Value);
282
282
}
283
283
@@ -310,13 +310,13 @@ inline bool isShiftedMask_64(uint64_t Value, unsigned &MaskIdx,
310
310
311
311
// / Compile time Log2.
312
312
// / Valid only for positive powers of two.
313
- template <size_t kValue > constexpr inline size_t CTLog2 () {
313
+ template <size_t kValue > constexpr size_t CTLog2 () {
314
314
static_assert (kValue > 0 && llvm::isPowerOf2_64 (kValue ),
315
315
" Value is not a valid power of 2" );
316
316
return 1 + CTLog2<kValue / 2 >();
317
317
}
318
318
319
- template <> constexpr inline size_t CTLog2<1 >() { return 0 ; }
319
+ template <> constexpr size_t CTLog2<1 >() { return 0 ; }
320
320
321
321
// / Return the floor log base 2 of the specified value, -1 if the value is zero.
322
322
// / (32 bit edition.)
@@ -346,7 +346,7 @@ inline unsigned Log2_64_Ceil(uint64_t Value) {
346
346
347
347
// / A and B are either alignments or offsets. Return the minimum alignment that
348
348
// / may be assumed after adding the two together.
349
- constexpr inline uint64_t MinAlign (uint64_t A, uint64_t B) {
349
+ constexpr uint64_t MinAlign (uint64_t A, uint64_t B) {
350
350
// The largest power of 2 that divides both A and B.
351
351
//
352
352
// Replace "-Value" by "1+~Value" in the following commented code to avoid
@@ -357,7 +357,7 @@ constexpr inline uint64_t MinAlign(uint64_t A, uint64_t B) {
357
357
358
358
// / Returns the next power of two (in 64-bits) that is strictly greater than A.
359
359
// / Returns zero on overflow.
360
- constexpr inline uint64_t NextPowerOf2 (uint64_t A) {
360
+ constexpr uint64_t NextPowerOf2 (uint64_t A) {
361
361
A |= (A >> 1 );
362
362
A |= (A >> 2 );
363
363
A |= (A >> 4 );
@@ -421,7 +421,7 @@ inline uint64_t alignTo(uint64_t Value, uint64_t Align, uint64_t Skew) {
421
421
422
422
// / Returns the next integer (mod 2**64) that is greater than or equal to
423
423
// / \p Value and is a multiple of \c Align. \c Align must be non-zero.
424
- template <uint64_t Align> constexpr inline uint64_t alignTo (uint64_t Value) {
424
+ template <uint64_t Align> constexpr uint64_t alignTo (uint64_t Value) {
425
425
static_assert (Align != 0u , " Align must be non-zero" );
426
426
return (Value + Align - 1 ) / Align * Align;
427
427
}
@@ -486,7 +486,7 @@ inline uint64_t alignDown(uint64_t Value, uint64_t Align, uint64_t Skew = 0) {
486
486
487
487
// / Sign-extend the number in the bottom B bits of X to a 32-bit integer.
488
488
// / Requires B <= 32.
489
- template <unsigned B> constexpr inline int32_t SignExtend32 (uint32_t X) {
489
+ template <unsigned B> constexpr int32_t SignExtend32 (uint32_t X) {
490
490
static_assert (B <= 32 , " Bit width out of range." );
491
491
if constexpr (B == 0 )
492
492
return 0 ;
@@ -504,7 +504,7 @@ inline int32_t SignExtend32(uint32_t X, unsigned B) {
504
504
505
505
// / Sign-extend the number in the bottom B bits of X to a 64-bit integer.
506
506
// / Requires B <= 64.
507
- template <unsigned B> constexpr inline int64_t SignExtend64 (uint64_t x) {
507
+ template <unsigned B> constexpr int64_t SignExtend64 (uint64_t x) {
508
508
static_assert (B <= 64 , " Bit width out of range." );
509
509
if constexpr (B == 0 )
510
510
return 0 ;
0 commit comments