smartOp.ilogb

Get the base 2 logarithm of abs(num), rounded down to the nearest integer.

smartOp.ilogb(0) will raise IntFlag.undef.

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

Examples

import checkedint.sticky : smartOp;

assert(smartOp.ilogb(20) == 4);
assert(smartOp.ilogb(-20) == 4);

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

Meta