safeOp.bsf

core.bitop.bsf without the undefined behaviour. safeOp.bsf(0) will raise IntFlag.undef.

template safeOp(IntFlagPolicy policy)
@safe
int
bsf
(
N
)
(
const N num
)

Examples

import checkedint.sticky : safeOp; // use IntFlagPolicy.sticky

assert(safeOp.bsf(20) == 2);

safeOp.bsf(0);
assert(IntFlags.local.clear() == IntFlag.undef);

Meta