llvm.org GIT mirror llvm / b68e2b6
[APInt] Remove an anonymous namespace around static functions. NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298899 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 3 years ago
1 changed file(s) with 39 addition(s) and 41 deletion(s). Raw diff Collapse all Expand all
23582358 static_assert(integerPartWidth % 2 == 0, "Part width must be divisible by 2!");
23592359
23602360 /* Some handy functions local to this file. */
2361 namespace {
2362
2363 /* Returns the integer part with the least significant BITS set.
2364 BITS cannot be zero. */
2365 static inline integerPart
2366 lowBitMask(unsigned bits)
2367 {
2368 assert(bits != 0 && bits <= integerPartWidth);
2369
2370 return ~(integerPart) 0 >> (integerPartWidth - bits);
2371 }
2372
2373 /* Returns the value of the lower half of PART. */
2374 static inline integerPart
2375 lowHalf(integerPart part)
2376 {
2377 return part & lowBitMask(integerPartWidth / 2);
2378 }
2379
2380 /* Returns the value of the upper half of PART. */
2381 static inline integerPart
2382 highHalf(integerPart part)
2383 {
2384 return part >> (integerPartWidth / 2);
2385 }
2386
2387 /* Returns the bit number of the most significant set bit of a part.
2388 If the input number has no bits set -1U is returned. */
2389 static unsigned
2390 partMSB(integerPart value)
2391 {
2392 return findLastSet(value, ZB_Max);
2393 }
2394
2395 /* Returns the bit number of the least significant set bit of a
2396 part. If the input number has no bits set -1U is returned. */
2397 static unsigned
2398 partLSB(integerPart value)
2399 {
2400 return findFirstSet(value, ZB_Max);
2401 }
2361
2362 /* Returns the integer part with the least significant BITS set.
2363 BITS cannot be zero. */
2364 static inline integerPart
2365 lowBitMask(unsigned bits)
2366 {
2367 assert(bits != 0 && bits <= integerPartWidth);
2368
2369 return ~(integerPart) 0 >> (integerPartWidth - bits);
2370 }
2371
2372 /* Returns the value of the lower half of PART. */
2373 static inline integerPart
2374 lowHalf(integerPart part)
2375 {
2376 return part & lowBitMask(integerPartWidth / 2);
2377 }
2378
2379 /* Returns the value of the upper half of PART. */
2380 static inline integerPart
2381 highHalf(integerPart part)
2382 {
2383 return part >> (integerPartWidth / 2);
2384 }
2385
2386 /* Returns the bit number of the most significant set bit of a part.
2387 If the input number has no bits set -1U is returned. */
2388 static unsigned
2389 partMSB(integerPart value)
2390 {
2391 return findLastSet(value, ZB_Max);
2392 }
2393
2394 /* Returns the bit number of the least significant set bit of a
2395 part. If the input number has no bits set -1U is returned. */
2396 static unsigned
2397 partLSB(integerPart value)
2398 {
2399 return findFirstSet(value, ZB_Max);
24022400 }
24032401
24042402 /* Sets the least significant part of a bignum to the input value, and