MathFu
An open source project by
FPL.
|
Utility macros and functions. More...
#include <assert.h>
#include <math.h>
#include <stdint.h>
#include <stdlib.h>
#include <algorithm>
#include <memory>
Go to the source code of this file.
Utility macros and functions.
Utilities
Classes | |
class | mathfu::simd_allocator< T > |
SIMD-safe memory allocator, for use with STL types like std::vector. More... | |
struct | mathfu::simd_allocator< T >::rebind< _Tp1 > |
Obtains an allocator of a different type. More... | |
Namespaces | |
mathfu | |
Namespace for MathFu library. | |
Macros | |
#define | MATHFU_COMPILE_WITHOUT_SIMD_SUPPORT |
Disable SIMD build configuration. More... | |
#define | MATHFU_COMPILE_FORCE_PADDING |
Enable / disable padding of data structures. More... | |
#define | MATHFU_VERSION_MAJOR 1 |
Major version number of the library. More... | |
#define | MATHFU_VERSION_MINOR 1 |
Minor version number of the library. More... | |
#define | MATHFU_VERSION_REVISION 0 |
Revision number of the library. More... | |
#define | MATHFU_BUILD_OPTIONS_STRING (MATHFU_BUILD_OPTIONS_SIMD " " MATHFU_BUILD_OPTIONS_PADDING) |
String that describes the library's build configuration. | |
#define | MATHFU_STATIC_ASSERT(x) static_assert_util<(x)>() |
Compile time assert for pre-C++11 compilers. More... | |
#define | MATHFU_ALIGNMENT 16 |
Alignment (in bytes) of memory allocated by AllocateAligned. More... | |
#define | MATHFU_DEFINE_GLOBAL_SIMD_AWARE_NEW_DELETE |
Macro which overrides the default new and delete allocators. More... | |
#define | MATHFU_DEFINE_CLASS_SIMD_AWARE_NEW_DELETE |
Macro which defines the new and delete for MathFu classes. More... | |
Functions | |
template<class T > | |
T | mathfu::Clamp (const T &x, const T &lower, const T &upper) |
Clamp x within [lower, upper]. More... | |
template<class T , class T2 > | |
T | mathfu::Lerp (const T &range_start, const T &range_end, const T2 &percent) |
Linearly interpolate between range_start and range_end, based on percent. More... | |
template<class T > | |
T | mathfu::Lerp (const T &range_start, const T &range_end, const T &percent) |
Linearly interpolate between range_start and range_end, based on percent. More... | |
template<class T > | |
bool | mathfu::InRange (T val, T range_start, T range_end) |
Check if val is within [range_start..range_end). More... | |
template<class T > | |
T | mathfu::Random () |
Generate a random value of type T. More... | |
template<class T > | |
T | mathfu::RandomRange (T range) |
Generate a random value of type T in the range -range...+range. More... | |
template<class T > | |
T | mathfu::RandomInRange (T range_start, T range_end) |
Generate a random number between [range_start, range_end]. More... | |
template<class T > | |
T | mathfu::RoundUpToPowerOf2 (T x) |
Round a value up to the nearest power of 2. More... | |
template<> | |
int32_t | mathfu::RoundUpToPowerOf2 (int32_t x) |
Specialized version of RoundUpToPowerOf2 for int32_t. | |
template<typename T > | |
uint32_t | mathfu::RoundUpToTypeBoundary (uint32_t v) |
Round a value up to the type's size boundary. More... | |
void * | mathfu::AllocateAligned (size_t n) |
Allocate an aligned block of memory. More... | |
void | mathfu::FreeAligned (void *p) |
Deallocate a block of memory allocated with AllocateAligned(). More... | |
Variables | |
volatile const char * | kMathFuVersionString |
String which identifies the current version of MathFu. More... | |