Number of Bits Needed to Represent a Zero-Offset Integer

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 19 09:35:53 PST 2015


On Monday, January 19, 2015 08:30:47 Steven Schveighoffer via Digitalmars-d-learn wrote:
> http://dlang.org/phobos/core_bitop.html#.bsr
>
> It's actually an intrinsic, reduces to an instruction. Mind the
> requirements for 0.

Sadly, I don't think that it have occurred to me from just reading the docs
that that function would tell you how many bits it took to hold the value -
though I don't know what else you'd use it for. In any case, thanks for the
tip.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list