next power of 2

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Oct 6 13:52:30 PDT 2012


On 10/6/12 4:48 PM, ref2401 wrote:
> is there any Phobos function to calculate the next power of 2 of the
> specified number?

Use 1U << bsr(x).

http://dlang.org/phobos/core_bitop.html#bsr


Andrei


More information about the Digitalmars-d-learn mailing list