1/* 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 --- 271 unchanged lines hidden (view full) --- 280 val++; 281 282 return val; 283}; 284 285/** 286 * Count trailing zeros in a 32-bit value. 287 * |
288 * @param An input value 289 * @return The number of trailing zeros or 32 if the value is zero. |
290 */ 291inline int ctz32(uint32_t value) 292{ |
293 return value ? __builtin_ctzl(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 307#endif // __BASE_BITFIELD_HH__ |