log2

Calculates log2

@trusted
int
log2
(
ulong n
)

Return Value

Type: int

log2(n)

Examples

// Undefined value returns -1
assert(log2(0) == -1);
assert(log2(17) == 4);
assert(log2(177) == 7);
assert(log2(0x1000_000_000) == 36);