Classes | Defines | Typedefs | Functions
Scalar.h File Reference
#include <math.h>
#include <stdlib.h>
#include <cstdlib>
#include <cfloat>
#include <float.h>
#include <assert.h>
Include dependency graph for Scalar.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tf2TypedObject
 rudimentary class to provide type info More...

Defines

#define ATTRIBUTE_ALIGNED128(a)   a
#define ATTRIBUTE_ALIGNED16(a)   a
#define ATTRIBUTE_ALIGNED64(a)   a
#define TF2_DECLARE_ALIGNED_ALLOCATOR()
#define TF2_DECLARE_HANDLE(name)   typedef struct name##__ { int unused; } *name
#define TF2_LARGE_FLOAT   1e30
#define tf2Assert(x)
#define tf2Fsels(a, b, c)   (tf2Scalar)tf2Fsel(a,b,c)
#define tf2FullAssert(x)
#define tf2Likely(_c)   _c
#define tf2RecipSqrt(x)   ((tf2Scalar)(tf2Scalar(1.0)/tf2Sqrt(tf2Scalar(x)))) /* reciprocal square root */
#define TF2SIMD_2_PI   tf2Scalar(6.283185307179586232)
#define TF2SIMD_DEGS_PER_RAD   (tf2Scalar(360.0) / TF2SIMD_2_PI)
#define TF2SIMD_EPSILON   DBL_EPSILON
#define TF2SIMD_FORCE_INLINE   inline
#define TF2SIMD_HALF_PI   (TF2SIMD_2_PI * tf2Scalar(0.25))
#define TF2SIMD_INFINITY   DBL_MAX
#define TF2SIMD_PI   (TF2SIMD_2_PI * tf2Scalar(0.5))
#define TF2SIMD_RADS_PER_DEG   (TF2SIMD_2_PI / tf2Scalar(360.0))
#define TF2SIMDSQRT12   tf2Scalar(0.7071067811865475244008443621048490)
#define tf2Unlikely(_c)   _c

Typedefs

typedef double tf2Scalar
 The tf2Scalar type abstracts floating point numbers, to easily switch between double and single floating point precision.

Functions

TF2SIMD_FORCE_INLINE tf2Scalar tf2Acos (tf2Scalar x)
TF2SIMD_FORCE_INLINE tf2Scalar tf2Asin (tf2Scalar x)
TF2SIMD_FORCE_INLINE tf2Scalar tf2Atan (tf2Scalar x)
TF2SIMD_FORCE_INLINE tf2Scalar tf2Atan2 (tf2Scalar x, tf2Scalar y)
TF2SIMD_FORCE_INLINE tf2Scalar tf2Atan2Fast (tf2Scalar y, tf2Scalar x)
TF2SIMD_FORCE_INLINE tf2Scalar tf2Cos (tf2Scalar x)
TF2SIMD_FORCE_INLINE tf2Scalar tf2Degrees (tf2Scalar x)
TF2SIMD_FORCE_INLINE bool tf2Equal (tf2Scalar a, tf2Scalar eps)
TF2SIMD_FORCE_INLINE tf2Scalar tf2Exp (tf2Scalar x)
TF2SIMD_FORCE_INLINE tf2Scalar tf2Fabs (tf2Scalar x)
TF2SIMD_FORCE_INLINE tf2Scalar tf2Fmod (tf2Scalar x, tf2Scalar y)
TF2SIMD_FORCE_INLINE tf2Scalar tf2Fsel (tf2Scalar a, tf2Scalar b, tf2Scalar c)
TF2SIMD_FORCE_INLINE bool tf2FuzzyZero (tf2Scalar x)
TF2SIMD_FORCE_INLINE bool tf2GreaterEqual (tf2Scalar a, tf2Scalar eps)
TF2SIMD_FORCE_INLINE int tf2IsNegative (tf2Scalar x)
TF2SIMD_FORCE_INLINE tf2Scalar tf2Log (tf2Scalar x)
TF2SIMD_FORCE_INLINE bool tf2MachineIsLittleEndian ()
TF2SIMD_FORCE_INLINE tf2Scalar tf2NormalizeAngle (tf2Scalar angleInRadians)
TF2SIMD_FORCE_INLINE tf2Scalar tf2Pow (tf2Scalar x, tf2Scalar y)
TF2SIMD_FORCE_INLINE tf2Scalar tf2Radians (tf2Scalar x)
TF2SIMD_FORCE_INLINE unsigned tf2Select (unsigned condition, unsigned valueIfConditionNonZero, unsigned valueIfConditionZero)
TF2SIMD_FORCE_INLINE int tf2Select (unsigned condition, int valueIfConditionNonZero, int valueIfConditionZero)
TF2SIMD_FORCE_INLINE float tf2Select (unsigned condition, float valueIfConditionNonZero, float valueIfConditionZero)
TF2SIMD_FORCE_INLINE tf2Scalar tf2Sin (tf2Scalar x)
TF2SIMD_FORCE_INLINE tf2Scalar tf2Sqrt (tf2Scalar x)
template<typename T >
TF2SIMD_FORCE_INLINE void tf2Swap (T &a, T &b)
TF2SIMD_FORCE_INLINE unsigned tf2SwapEndian (unsigned val)
TF2SIMD_FORCE_INLINE unsigned short tf2SwapEndian (unsigned short val)
TF2SIMD_FORCE_INLINE unsigned tf2SwapEndian (int val)
TF2SIMD_FORCE_INLINE unsigned short tf2SwapEndian (short val)
TF2SIMD_FORCE_INLINE void tf2SwapEndianDouble (double d, unsigned char *dst)
TF2SIMD_FORCE_INLINE unsigned int tf2SwapEndianFloat (float d)
 tf2SwapFloat uses using char pointers to swap the endianness
TF2SIMD_FORCE_INLINE tf2Scalar tf2Tan (tf2Scalar x)
TF2SIMD_FORCE_INLINE double tf2UnswapEndianDouble (const unsigned char *src)
TF2SIMD_FORCE_INLINE float tf2UnswapEndianFloat (unsigned int a)

Define Documentation

#define ATTRIBUTE_ALIGNED128 (   a)    a

Definition at line 136 of file Scalar.h.

#define ATTRIBUTE_ALIGNED16 (   a)    a
Todo:
: check out alignment methods for other platforms/compilers define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16))) define ATTRIBUTE_ALIGNED64(a) a __attribute__ ((aligned (64))) define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (128)))

Definition at line 134 of file Scalar.h.

#define ATTRIBUTE_ALIGNED64 (   a)    a

Definition at line 135 of file Scalar.h.

Value:
TF2SIMD_FORCE_INLINE void* operator new(size_t sizeInBytes)   { return tf2AlignedAlloc(sizeInBytes,16); }   \
   TF2SIMD_FORCE_INLINE void  operator delete(void* ptr)         { tf2AlignedFree(ptr); }   \
   TF2SIMD_FORCE_INLINE void* operator new(size_t, void* ptr)   { return ptr; }   \
   TF2SIMD_FORCE_INLINE void  operator delete(void*, void*)      { }   \
   TF2SIMD_FORCE_INLINE void* operator new[](size_t sizeInBytes)   { return tf2AlignedAlloc(sizeInBytes,16); }   \
   TF2SIMD_FORCE_INLINE void  operator delete[](void* ptr)         { tf2AlignedFree(ptr); }   \
   TF2SIMD_FORCE_INLINE void* operator new[](size_t, void* ptr)   { return ptr; }   \
   TF2SIMD_FORCE_INLINE void  operator delete[](void*, void*)      { }   \

Definition at line 164 of file Scalar.h.

#define TF2_DECLARE_HANDLE (   name)    typedef struct name##__ { int unused; } *name

Definition at line 238 of file Scalar.h.

#define TF2_LARGE_FLOAT   1e30

Definition at line 161 of file Scalar.h.

#define tf2Assert (   x)

Definition at line 144 of file Scalar.h.

#define tf2Fsels (   a,
  b,
 
)    (tf2Scalar)tf2Fsel(a,b,c)

Definition at line 246 of file Scalar.h.

#define tf2FullAssert (   x)

Definition at line 148 of file Scalar.h.

#define tf2Likely (   _c)    _c

Definition at line 149 of file Scalar.h.

#define tf2RecipSqrt (   x)    ((tf2Scalar)(tf2Scalar(1.0)/tf2Sqrt(tf2Scalar(x)))) /* reciprocal square root */

Definition at line 199 of file Scalar.h.

#define TF2SIMD_2_PI   tf2Scalar(6.283185307179586232)

Definition at line 192 of file Scalar.h.

#define TF2SIMD_DEGS_PER_RAD   (tf2Scalar(360.0) / TF2SIMD_2_PI)

Definition at line 196 of file Scalar.h.

#define TF2SIMD_EPSILON   DBL_EPSILON

Definition at line 202 of file Scalar.h.

#define TF2SIMD_FORCE_INLINE   inline

Definition at line 129 of file Scalar.h.

#define TF2SIMD_HALF_PI   (TF2SIMD_2_PI * tf2Scalar(0.25))

Definition at line 194 of file Scalar.h.

#define TF2SIMD_INFINITY   DBL_MAX

Definition at line 203 of file Scalar.h.

#define TF2SIMD_PI   (TF2SIMD_2_PI * tf2Scalar(0.5))

Definition at line 193 of file Scalar.h.

#define TF2SIMD_RADS_PER_DEG   (TF2SIMD_2_PI / tf2Scalar(360.0))

Definition at line 195 of file Scalar.h.

#define TF2SIMDSQRT12   tf2Scalar(0.7071067811865475244008443621048490)

Definition at line 197 of file Scalar.h.

#define tf2Unlikely (   _c)    _c

Definition at line 150 of file Scalar.h.


Typedef Documentation

typedef double tf2Scalar

The tf2Scalar type abstracts floating point numbers, to easily switch between double and single floating point precision.

Definition at line 159 of file Scalar.h.


Function Documentation

Definition at line 182 of file Scalar.h.

Definition at line 183 of file Scalar.h.

Definition at line 184 of file Scalar.h.

Definition at line 185 of file Scalar.h.

Definition at line 205 of file Scalar.h.

Definition at line 179 of file Scalar.h.

Definition at line 236 of file Scalar.h.

Definition at line 223 of file Scalar.h.

Definition at line 186 of file Scalar.h.

Definition at line 178 of file Scalar.h.

Definition at line 189 of file Scalar.h.

Definition at line 241 of file Scalar.h.

Definition at line 221 of file Scalar.h.

Definition at line 226 of file Scalar.h.

Definition at line 231 of file Scalar.h.

Definition at line 187 of file Scalar.h.

Definition at line 249 of file Scalar.h.

Definition at line 387 of file Scalar.h.

Definition at line 188 of file Scalar.h.

Definition at line 235 of file Scalar.h.

TF2SIMD_FORCE_INLINE unsigned tf2Select ( unsigned  condition,
unsigned  valueIfConditionNonZero,
unsigned  valueIfConditionZero 
)

tf2Select avoids branches, which makes performance much better for consoles like Playstation 3 and XBox 360 Thanks Phil Knight. See also http://www.cellperformance.com/articles/2006/04/more_techniques_for_eliminatin_1.html

Definition at line 263 of file Scalar.h.

TF2SIMD_FORCE_INLINE int tf2Select ( unsigned  condition,
int  valueIfConditionNonZero,
int  valueIfConditionZero 
)

Definition at line 273 of file Scalar.h.

TF2SIMD_FORCE_INLINE float tf2Select ( unsigned  condition,
float  valueIfConditionNonZero,
float  valueIfConditionZero 
)

Definition at line 279 of file Scalar.h.

Definition at line 180 of file Scalar.h.

Definition at line 177 of file Scalar.h.

template<typename T >
TF2SIMD_FORCE_INLINE void tf2Swap ( T &  a,
T &  b 
)

Definition at line 288 of file Scalar.h.

TF2SIMD_FORCE_INLINE unsigned tf2SwapEndian ( unsigned  val)

Definition at line 297 of file Scalar.h.

TF2SIMD_FORCE_INLINE unsigned short tf2SwapEndian ( unsigned short  val)

Definition at line 302 of file Scalar.h.

TF2SIMD_FORCE_INLINE unsigned tf2SwapEndian ( int  val)

Definition at line 307 of file Scalar.h.

TF2SIMD_FORCE_INLINE unsigned short tf2SwapEndian ( short  val)

Definition at line 312 of file Scalar.h.

TF2SIMD_FORCE_INLINE void tf2SwapEndianDouble ( double  d,
unsigned char *  dst 
)

Definition at line 353 of file Scalar.h.

TF2SIMD_FORCE_INLINE unsigned int tf2SwapEndianFloat ( float  d)

tf2SwapFloat uses using char pointers to swap the endianness

tf2SwapFloat/tf2SwapDouble will NOT return a float, because the machine might 'correct' invalid floating point values Not all values of sign/exponent/mantissa are valid floating point numbers according to IEEE 754. When a floating point unit is faced with an invalid value, it may actually change the value, or worse, throw an exception. In most systems, running user mode code, you wouldn't get an exception, but instead the hardware/os/runtime will 'fix' the number for you. so instead of returning a float/double, we return integer/long long integer

Definition at line 323 of file Scalar.h.

Definition at line 181 of file Scalar.h.

TF2SIMD_FORCE_INLINE double tf2UnswapEndianDouble ( const unsigned char *  src)

Definition at line 369 of file Scalar.h.

TF2SIMD_FORCE_INLINE float tf2UnswapEndianFloat ( unsigned int  a)

Definition at line 337 of file Scalar.h.



tf2
Author(s): Tully Foote, Eitan Marder-Eppstein, Wim Meeussen
autogenerated on Thu Jun 6 2019 20:22:56