1/*
2 * Copyright (c) 2017 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
--- 268 unchanged lines hidden (view full) ---
277 val |= val >> 8;
278 val |= val >> 16;
279 val |= val >> 32;
280 val++;
281
282 return val;
283};
284
285/**
286 * Count trailing zeros in a 32-bit value.
287 *
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#endif // __BASE_BITFIELD_HH__
2 * Copyright (c) 2017 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
--- 268 unchanged lines hidden (view full) ---
277 val |= val >> 8;
278 val |= val >> 16;
279 val |= val >> 32;
280 val++;
281
282 return val;
283};
284
285/**
286 * Count trailing zeros in a 32-bit value.
287 *
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#endif // __BASE_BITFIELD_HH__