smartOp.bsf

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

template smartOp(IntFlagPolicy policy)
@safe
ubyte
bsf
(
N
)
(
const N num
)

Examples

import checkedint.sticky : smartOp;

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

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

Meta