core.bitop.bsf without the undefined behaviour. safeOp.bsf(0) will raise IntFlag.undef.
import checkedint.sticky : safeOp; // use IntFlagPolicy.sticky assert(safeOp.bsf(20) == 2); safeOp.bsf(0); assert(IntFlags.local.clear() == IntFlag.undef);
See Implementation
core.bitop.bsf without the undefined behaviour. safeOp.bsf(0) will raise IntFlag.undef.