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