ae.utils.math

Number stuff

Members

Aliases

flipBits
alias flipBits = unary!'~'

Like the ~ operator, but without int-promotion.

Functions

average
auto average(T args)
Undocumented in source. Be warned that the author may not have intended to support it.
between
bool between(T point, T a, T b)
Undocumented in source. Be warned that the author may not have intended to support it.
bitsFor
ubyte bitsFor(T n)

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

bound
typeof(Ta + Tb + Tc) bound(Ta a, Tb b, Tc c)
Undocumented in source. Be warned that the author may not have intended to support it.
compare
int compare(T a, T b)
Undocumented in source. Be warned that the author may not have intended to support it.
ilog2
ubyte ilog2(T n)

Integer log2.

isPowerOfTwo
bool isPowerOfTwo(T x)
Undocumented in source. Be warned that the author may not have intended to support it.
itpl
T itpl(T low, T high, U r, U rLow, U rHigh)
Undocumented in source. Be warned that the author may not have intended to support it.
nextPowerOfTwo
T nextPowerOfTwo(T x)
Undocumented in source. Be warned that the author may not have intended to support it.
op
auto op(T args)
Undocumented in source. Be warned that the author may not have intended to support it.
roundUpToPowerOfTwo
T roundUpToPowerOfTwo(T x)
Undocumented in source. Be warned that the author may not have intended to support it.
sign
byte sign(T x)
Undocumented in source. Be warned that the author may not have intended to support it.
sort2
void sort2(T x, T y)
Undocumented in source. Be warned that the author may not have intended to support it.
sqr
auto sqr(T x)
Undocumented in source. Be warned that the author may not have intended to support it.
sum
auto sum(T args)
Undocumented in source. Be warned that the author may not have intended to support it.
swapBytes
T swapBytes(T b)
Undocumented in source. Be warned that the author may not have intended to support it.

Templates

TypeForBits
template TypeForBits(uint bits)

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

unary
template unary(char op)
Undocumented in source.

Meta

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/.

Authors

Vladimir Panteleev <vladimir@thecybershadow.net>