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  tfTypedObject
 rudimentary class to provide type info More...

Defines

#define ATTRIBUTE_ALIGNED128(a)   a
#define ATTRIBUTE_ALIGNED16(a)   a
#define ATTRIBUTE_ALIGNED64(a)   a
#define TF_DECLARE_ALIGNED_ALLOCATOR()
#define TF_DECLARE_HANDLE(name)   typedef struct name##__ { int unused; } *name
#define TF_LARGE_FLOAT   1e30
#define tfAssert(x)
#define tfFsels(a, b, c)   (tfScalar)tfFsel(a,b,c)
#define tfFullAssert(x)
#define tfLikely(_c)   _c
#define tfRecipSqrt(x)   ((tfScalar)(tfScalar(1.0)/tfSqrt(tfScalar(x)))) /* reciprocal square root */
#define TFSIMD_2_PI   tfScalar(6.283185307179586232)
#define TFSIMD_DEGS_PER_RAD   (tfScalar(360.0) / TFSIMD_2_PI)
#define TFSIMD_EPSILON   DBL_EPSILON
#define TFSIMD_FORCE_INLINE   inline
#define TFSIMD_HALF_PI   (TFSIMD_2_PI * tfScalar(0.25))
#define TFSIMD_INFINITY   DBL_MAX
#define TFSIMD_PI   (TFSIMD_2_PI * tfScalar(0.5))
#define TFSIMD_RADS_PER_DEG   (TFSIMD_2_PI / tfScalar(360.0))
#define TFSIMDSQRT12   tfScalar(0.7071067811865475244008443621048490)
#define tfUnlikely(_c)   _c

Typedefs

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

Functions

TFSIMD_FORCE_INLINE tfScalar tfAcos (tfScalar x)
TFSIMD_FORCE_INLINE tfScalar tfAsin (tfScalar x)
TFSIMD_FORCE_INLINE tfScalar tfAtan (tfScalar x)
TFSIMD_FORCE_INLINE tfScalar tfAtan2 (tfScalar x, tfScalar y)
TFSIMD_FORCE_INLINE tfScalar tfAtan2Fast (tfScalar y, tfScalar x)
TFSIMD_FORCE_INLINE tfScalar tfCos (tfScalar x)
TFSIMD_FORCE_INLINE tfScalar tfDegrees (tfScalar x)
TFSIMD_FORCE_INLINE bool tfEqual (tfScalar a, tfScalar eps)
TFSIMD_FORCE_INLINE tfScalar tfExp (tfScalar x)
TFSIMD_FORCE_INLINE tfScalar tfFabs (tfScalar x)
TFSIMD_FORCE_INLINE tfScalar tfFmod (tfScalar x, tfScalar y)
TFSIMD_FORCE_INLINE tfScalar tfFsel (tfScalar a, tfScalar b, tfScalar c)
TFSIMD_FORCE_INLINE bool tfFuzzyZero (tfScalar x)
TFSIMD_FORCE_INLINE bool tfGreaterEqual (tfScalar a, tfScalar eps)
TFSIMD_FORCE_INLINE int tfIsNegative (tfScalar x)
TFSIMD_FORCE_INLINE tfScalar tfLog (tfScalar x)
TFSIMD_FORCE_INLINE bool tfMachineIsLittleEndian ()
TFSIMD_FORCE_INLINE tfScalar tfNormalizeAngle (tfScalar angleInRadians)
TFSIMD_FORCE_INLINE tfScalar tfPow (tfScalar x, tfScalar y)
TFSIMD_FORCE_INLINE tfScalar tfRadians (tfScalar x)
TFSIMD_FORCE_INLINE unsigned tfSelect (unsigned condition, unsigned valueIfConditionNonZero, unsigned valueIfConditionZero)
TFSIMD_FORCE_INLINE int tfSelect (unsigned condition, int valueIfConditionNonZero, int valueIfConditionZero)
TFSIMD_FORCE_INLINE float tfSelect (unsigned condition, float valueIfConditionNonZero, float valueIfConditionZero)
TFSIMD_FORCE_INLINE tfScalar tfSin (tfScalar x)
TFSIMD_FORCE_INLINE tfScalar tfSqrt (tfScalar x)
template<typename T >
TFSIMD_FORCE_INLINE void tfSwap (T &a, T &b)
TFSIMD_FORCE_INLINE unsigned tfSwapEndian (unsigned val)
TFSIMD_FORCE_INLINE unsigned short tfSwapEndian (unsigned short val)
TFSIMD_FORCE_INLINE unsigned tfSwapEndian (int val)
TFSIMD_FORCE_INLINE unsigned short tfSwapEndian (short val)
TFSIMD_FORCE_INLINE void tfSwapEndianDouble (double d, unsigned char *dst)
TFSIMD_FORCE_INLINE unsigned int tfSwapEndianFloat (float d)
 tfSwapFloat uses using char pointers to swap the endianness
TFSIMD_FORCE_INLINE tfScalar tfTan (tfScalar x)
TFSIMD_FORCE_INLINE double tfUnswapEndianDouble (const unsigned char *src)
TFSIMD_FORCE_INLINE float tfUnswapEndianFloat (unsigned int a)

Define Documentation

#define ATTRIBUTE_ALIGNED128 (   a)    a

Definition at line 137 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 135 of file Scalar.h.

#define ATTRIBUTE_ALIGNED64 (   a)    a

Definition at line 136 of file Scalar.h.

Value:
TFSIMD_FORCE_INLINE void* operator new(size_t sizeInBytes)   { return tfAlignedAlloc(sizeInBytes,16); }   \
   TFSIMD_FORCE_INLINE void  operator delete(void* ptr)         { tfAlignedFree(ptr); }   \
   TFSIMD_FORCE_INLINE void* operator new(size_t, void* ptr)   { return ptr; }   \
   TFSIMD_FORCE_INLINE void  operator delete(void*, void*)      { }   \
   TFSIMD_FORCE_INLINE void* operator new[](size_t sizeInBytes)   { return tfAlignedAlloc(sizeInBytes,16); }   \
   TFSIMD_FORCE_INLINE void  operator delete[](void* ptr)         { tfAlignedFree(ptr); }   \
   TFSIMD_FORCE_INLINE void* operator new[](size_t, void* ptr)   { return ptr; }   \
   TFSIMD_FORCE_INLINE void  operator delete[](void*, void*)      { }   \

Definition at line 166 of file Scalar.h.

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

Definition at line 240 of file Scalar.h.

#define TF_LARGE_FLOAT   1e30

Definition at line 162 of file Scalar.h.

#define tfAssert (   x)

Definition at line 145 of file Scalar.h.

#define tfFsels (   a,
  b,
 
)    (tfScalar)tfFsel(a,b,c)

Definition at line 248 of file Scalar.h.

#define tfFullAssert (   x)

Definition at line 149 of file Scalar.h.

#define tfLikely (   _c)    _c

Definition at line 150 of file Scalar.h.

#define tfRecipSqrt (   x)    ((tfScalar)(tfScalar(1.0)/tfSqrt(tfScalar(x)))) /* reciprocal square root */

Definition at line 201 of file Scalar.h.

#define TFSIMD_2_PI   tfScalar(6.283185307179586232)

Definition at line 194 of file Scalar.h.

#define TFSIMD_DEGS_PER_RAD   (tfScalar(360.0) / TFSIMD_2_PI)

Definition at line 198 of file Scalar.h.

#define TFSIMD_EPSILON   DBL_EPSILON

Definition at line 204 of file Scalar.h.

#define TFSIMD_FORCE_INLINE   inline

Definition at line 130 of file Scalar.h.

#define TFSIMD_HALF_PI   (TFSIMD_2_PI * tfScalar(0.25))

Definition at line 196 of file Scalar.h.

#define TFSIMD_INFINITY   DBL_MAX

Definition at line 205 of file Scalar.h.

#define TFSIMD_PI   (TFSIMD_2_PI * tfScalar(0.5))

Definition at line 195 of file Scalar.h.

#define TFSIMD_RADS_PER_DEG   (TFSIMD_2_PI / tfScalar(360.0))

Definition at line 197 of file Scalar.h.

#define TFSIMDSQRT12   tfScalar(0.7071067811865475244008443621048490)

Definition at line 199 of file Scalar.h.

#define tfUnlikely (   _c)    _c

Definition at line 151 of file Scalar.h.


Typedef Documentation

typedef double tfScalar

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

Definition at line 160 of file Scalar.h.


Function Documentation

Definition at line 184 of file Scalar.h.

Definition at line 185 of file Scalar.h.

Definition at line 186 of file Scalar.h.

Definition at line 187 of file Scalar.h.

Definition at line 207 of file Scalar.h.

Definition at line 181 of file Scalar.h.

Definition at line 238 of file Scalar.h.

Definition at line 225 of file Scalar.h.

Definition at line 188 of file Scalar.h.

Definition at line 180 of file Scalar.h.

Definition at line 191 of file Scalar.h.

Definition at line 243 of file Scalar.h.

Definition at line 223 of file Scalar.h.

Definition at line 228 of file Scalar.h.

Definition at line 233 of file Scalar.h.

Definition at line 189 of file Scalar.h.

Definition at line 251 of file Scalar.h.

Definition at line 389 of file Scalar.h.

Definition at line 190 of file Scalar.h.

Definition at line 237 of file Scalar.h.

TFSIMD_FORCE_INLINE unsigned tfSelect ( unsigned  condition,
unsigned  valueIfConditionNonZero,
unsigned  valueIfConditionZero 
)

tfSelect 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 265 of file Scalar.h.

TFSIMD_FORCE_INLINE int tfSelect ( unsigned  condition,
int  valueIfConditionNonZero,
int  valueIfConditionZero 
)

Definition at line 275 of file Scalar.h.

TFSIMD_FORCE_INLINE float tfSelect ( unsigned  condition,
float  valueIfConditionNonZero,
float  valueIfConditionZero 
)

Definition at line 281 of file Scalar.h.

Definition at line 182 of file Scalar.h.

Definition at line 179 of file Scalar.h.

template<typename T >
TFSIMD_FORCE_INLINE void tfSwap ( T &  a,
T &  b 
)

Definition at line 290 of file Scalar.h.

TFSIMD_FORCE_INLINE unsigned tfSwapEndian ( unsigned  val)

Definition at line 299 of file Scalar.h.

TFSIMD_FORCE_INLINE unsigned short tfSwapEndian ( unsigned short  val)

Definition at line 304 of file Scalar.h.

TFSIMD_FORCE_INLINE unsigned tfSwapEndian ( int  val)

Definition at line 309 of file Scalar.h.

TFSIMD_FORCE_INLINE unsigned short tfSwapEndian ( short  val)

Definition at line 314 of file Scalar.h.

TFSIMD_FORCE_INLINE void tfSwapEndianDouble ( double  d,
unsigned char *  dst 
)

Definition at line 355 of file Scalar.h.

TFSIMD_FORCE_INLINE unsigned int tfSwapEndianFloat ( float  d)

tfSwapFloat uses using char pointers to swap the endianness

tfSwapFloat/tfSwapDouble 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 325 of file Scalar.h.

Definition at line 183 of file Scalar.h.

TFSIMD_FORCE_INLINE double tfUnswapEndianDouble ( const unsigned char *  src)

Definition at line 371 of file Scalar.h.

TFSIMD_FORCE_INLINE float tfUnswapEndianFloat ( unsigned int  a)

Definition at line 339 of file Scalar.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


tf
Author(s): Tully Foote, Eitan Marder-Eppstein, Wim Meeussen
autogenerated on Thu Aug 22 2013 11:29:01