bitfield.hh (13824:54e92033cf67) | bitfield.hh (14045:219770957562) |
---|---|
1/* | 1/* |
2 * Copyright (c) 2017 ARM Limited | 2 * Copyright (c) 2017, 2019 ARM Limited |
3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software 9 * licensed hereunder. You may use the software subject to the license 10 * terms below provided that you ensure that this notice is replicated --- 277 unchanged lines hidden (view full) --- 288 * Returns 32 if the value is zero. Note that the GCC builtin is 289 * undefined if the value is zero. 290 */ 291inline int ctz32(uint32_t value) 292{ 293 return value ? __builtin_ctz(value) : 32; 294} 295 | 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software 9 * licensed hereunder. You may use the software subject to the license 10 * terms below provided that you ensure that this notice is replicated --- 277 unchanged lines hidden (view full) --- 288 * Returns 32 if the value is zero. Note that the GCC builtin is 289 * undefined if the value is zero. 290 */ 291inline int ctz32(uint32_t value) 292{ 293 return value ? __builtin_ctz(value) : 32; 294} 295 |
296/** 297 * Count trailing zeros in a 64-bit value. 298 * 299 * @param An input value 300 * @return The number of trailing zeros or 64 if the value is zero. 301 */ 302inline int ctz64(uint64_t value) 303{ 304 return value ? __builtin_ctzll(value) : 64; 305} 306 |
|
296#endif // __BASE_BITFIELD_HH__ | 307#endif // __BASE_BITFIELD_HH__ |