ae.utils.math

Number stuff

Members

Aliases

flipBits
alias flipBits = unary!'~'

Like the ~ operator, but without int-promotion.

Functions

bitsFor
ubyte bitsFor(T n)

Returns the number of bits needed to store a number up to n (inclusive).

ilog2
ubyte ilog2(T n)

Integer log2.

Templates

TypeForBits
template TypeForBits(uint bits)

Get the smallest built-in unsigned integer type that can store this many bits of data.

Meta

Authors

Vladimir Panteleev <vladimir@thecybershadow.net>

License

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.