|
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 to 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> | |
| bool | Bond::IsPowerOfTwo (T value) |
| Returns whether an integer is a power of two. 0 is not a power of two. | |
| template<typename T> | |
| T | Bond::RoundUpToPowerOfTwo32 (T value) |
| Rounds a 32 bit integer up to the nearest power of two. Values that are already powers of two are returned unchanged and 0 is returned as 0. The result is only correct for values no greater than 2^31. | |
| template<typename T> | |
| T | Bond::Abs (T value) |
| Returns the absolute value of a number. | |
| template<typename RangeType, typename ValueType> | |
| bool | Bond::IsInRange (ValueType value) |
| Returns whether value is exactly representable by RangeType, i.e. whether converting it to RangeType and back is lossless. NaN and infinity are never representable. | |
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 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 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. |
| bool Bond::IsInRange | ( | ValueType | value | ) |
Returns whether value is exactly representable by RangeType, i.e. whether converting it to RangeType and back is lossless. NaN and infinity are never representable.
|
inline |
Returns whether an integer is a power of two. 0 is not a power of two.
| value | The value to test. |
|
inline |
Rounds a 32 bit integer up to the nearest power of two. Values that are already powers of two are returned unchanged and 0 is returned as 0. The result is only correct for values no greater than 2^31.
| value | The value to be rounded. |