![]() |
TGX 1.0.3
A tiny 2D/3D graphics library optimized for 32 bits microcontrollers.
|
Utility/miscellaneous functions used throughout the library. More...
#include <stdint.h>
#include <math.h>
#include <string.h>
#include "Arduino.h"
Go to the source code of this file.
Functions | |
TGX_INLINE uint16_t | tgx::BigEndian16 (uint16_t v) |
little endian / big endian conversion | |
template<typename T > | |
TGX_INLINE void | tgx::swap (T &a, T &b) |
Baby let me swap you one more time... | |
template<typename T > | |
TGX_INLINE T | tgx::min (const T &a, const T &b) |
Don't know why but faster than fminf() for floats. | |
template<typename T > | |
TGX_INLINE T | tgx::max (const T &a, const T &b) |
Don't know why but much faster than fmaxf() for floats. | |
template<typename T > | |
TGX_INLINE T | tgx::clamp (const T &v, const T &vmin, const T &vmax) |
Template clamp version. | |
TGX_INLINE float | tgx::roundfp (const float f) |
Rounding for floats. | |
TGX_INLINE double | tgx::roundfp (const double f) |
Rounding for doubles. | |
TGX_INLINE int32_t | tgx::safeMultB (int32_t A, int32_t B) |
Return a value smaller or equal to B such that the multiplication by A is safe (no overflow with int32). | |
TGX_INLINE float | tgx::fast_inv (float x) |
Fast (approximate) computation of 1/x. More... | |
TGX_INLINE double | tgx::fast_inv (double x) |
Fast (approximate) computation of 1/x. More... | |
TGX_INLINE float | tgx::precise_sqrt (float x) |
Compute the square root of a float (exact computation). | |
TGX_INLINE double | tgx::precise_sqrt (double x) |
Compute the square root of a double (exact computation). | |
TGX_INLINE float | tgx::fast_sqrt (float x) |
Compute a fast approximation of the square root of a float. | |
TGX_INLINE double | tgx::fast_sqrt (double x) |
Compute a fast approximation of the square root of a double. | |
TGX_INLINE float | tgx::precise_invsqrt (float x) |
Compute the inverse square root of a float (exact computation). | |
TGX_INLINE double | tgx::precise_invsqrt (double x) |
Compute the inverse square root of a double (exact computation). | |
TGX_INLINE float | tgx::fast_invsqrt (float x) |
Compute a fast approximation of the inverse square root of a float. | |
TGX_INLINE double | tgx::fast_invsqrt (double x) |
Compute a fast approximation of the inverse square root of a float. | |
Utility/miscellaneous functions used throughout the library.
|
inline |
Fast (approximate) computation of 1/x.
Version for float.
|
inline |
Fast (approximate) computation of 1/x.
Version for double.