5 #ifndef OPENTITAN_SW_DEVICE_LIB_BASE_BITFIELD_H_
6 #define OPENTITAN_SW_DEVICE_LIB_BASE_BITFIELD_H_
56 return (bitfield >> field.
index) & field.
mask;
76 bitfield |= (value & field.
mask) << field.
index;
138 value ? 0x1u : 0x0u);
178 return __builtin_ffs(bitfield);
202 return (bitfield != 0) ? __builtin_clz(bitfield) : 32;
226 return (bitfield != 0) ? __builtin_ctz(bitfield) : 32;
248 return __builtin_popcount(bitfield);
270 return __builtin_parity(bitfield);
293 return __builtin_bswap32(bitfield);
306 return bitfield != 0 && (bitfield & (bitfield - 1)) == 0;