|
Bond 0.9
C++ Bond Runtime Library API Documentation
|
Useful math functions. More...
Functions | |
| template<typename T> | |
| T | Bond::AlignDown (T value, T align) |
| Rounds an integer down to the nearest multiple of a specified power of two. | |
| template<typename T> | |
| T | Bond::AlignUp (T value, T align) |
| Rounds an integer up to the nearest multiple of a specified power of two. | |
| template<typename T> | |
| T | Bond::AlignUpDelta (T value, T align) |
| Returns the difference between an integer and the nearest larger multiple of a specified power of two. | |
| template<typename T> | |
| T * | Bond::AlignPointerDown (T *ptr, size_t align) |
| Rounds a pointer down the nearest multiple of a specified power of two. | |
| template<typename T> | |
| T * | Bond::AlignPointerUp (T *ptr, size_t align) |
| Rounds a pointer up to the nearest multiple of a specified power of two. | |
| template<typename T> | |
| T | Bond::IsPowerOfTwo (T value) |
| Returns whether an integer is a power of two. | |
| template<typename T> | |
| T | Bond::RoundUpToPowerOfTwo32 (T value) |
| Rounds a 32 bit integer up to the nearest power of two. | |
| template<typename T> | |
| T | Bond::Abs (T value) |
| Returns the absolute value of a number. | |
| template<typename T> | |
| T | Bond::Min (T a, T b) |
| Compares two numbers and returns the smaller of the two. | |
| template<typename T> | |
| T | Bond::Max (T a, T b) |
| Compares two numbers and returns the larger of the two. | |
Useful math functions.
|
inline |
Returns the absolute value of a number.
| value | The number whose absolute value is evaluated. |
|
inline |
Rounds an integer down to the nearest multiple of a specified power of two.
| value | The value to be rounded. |
| align | The power of two around which the value is rounded. |
|
inline |
Rounds a pointer down the nearest multiple of a specified power of two.
| ptr | The pointer to be rounded. |
| align | The power of two around which the pointer is rounded. |
|
inline |
Rounds a pointer up to the nearest multiple of a specified power of two.
| ptr | The pointer to be rounded. |
| align | The power of two around which the pointer is rounded. |
|
inline |
Rounds an integer up to the nearest multiple of a specified power of two.
| value | The value to be rounded. |
| align | The power of two around which the value is rounded. |
|
inline |
Returns the difference between an integer and the nearest larger multiple of a specified power of two.
| value | The value to be rounded. |
| align | The power of two around which the value is rounded. |
|
inline |
Returns whether an integer is a power of two.
| value | The value to test. |
|
inline |
Compares two numbers and returns the larger of the two.
| a | The first of the two compared numbers. |
| b | The second of the two compared numbers. |
|
inline |
Compares two numbers and returns the smaller of the two.
| a | The first of the two compared numbers. |
| b | The second of the two compared numbers. |
|
inline |
Rounds a 32 bit integer up to the nearest power of two.
| value | The value to be rounded. |