My Project: dynamics.mod/NewtonDynamics/source/core/dgTypes.h File Reference

My Project

Classes | Macros | Typedefs | Functions
dgTypes.h File Reference
`#include <new>`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <stdarg.h>`
`#include <time.h>`
`#include <math.h>`
`#include <float.h>`
`#include <ctype.h>`
`#include <pthread.h>`
`#include <sched.h>`
`#include <semaphore.h>`

Go to the source code of this file.

## Classes

class | dgTriplex
union | dgFloatSign
union | dgDoubleInt
class | dgFloatExceptions
class | dgSetPrecisionDouble

## Macros

#define | dgAssert(x)
#define | DG_MAX_THREADS_HIVE_COUNT 16
#define | DG_INLINE inline
#define | DG_VECTOR_SIMD_SIZE 16
#define | DG_MSC_VECTOR_ALIGMENT
#define | DG_GCC_VECTOR_ALIGMENT __attribute__ ((aligned (DG_VECTOR_SIMD_SIZE)))
#define | dgPI dgFloat32 (3.14159f)
#define | dgPI2 dgFloat32 (dgPI * 2.0f)
#define | dgEXP dgFloat32 (2.71828f)
#define | dgEPSILON dgFloat32 (1.0e-5f)
#define | dgGRAVITY dgFloat32 (9.8f)
#define | dgDEG2RAD dgFloat32 (dgPI / 180.0f)
#define | dgRAD2DEG dgFloat32 (180.0f / dgPI)
#define | dgKMH2MPSEC dgFloat32 (0.278f)
#define | dgApi
#define | dgStdApi
#define | dgCheckFloat(x) (isfinite(x) && !isnan(x))
#define | PointerToInt(x) ((size_t)x)
#define | IntToPointer(x) ((void*)(size_t(x)))
#define | _stricmp(x, y) strcasecmp(x,y)
#define | dgSqrt(x) dgFloat32 (sqrt(x))
#define | dgSin(x) dgFloat32 (sin(x))
#define | dgCos(x) dgFloat32 (cos(x))
#define | dgAsin(x) dgFloat32 (asin(x))
#define | dgAcos(x) dgFloat32 (acos(x))
#define | dgAtan2(x, y) dgFloat32 (atan2(x,y))
#define | dgLog(x) dgFloat32 (log(x))
#define | dgPow(x, y) dgFloat32 (pow(x,y))
#define | dgFmod(x, y) dgFloat32 (fmod(x,y))
#define | dgClearFP() _clearfp()
#define | dgControlFP(x, y) _controlfp(x,y)

## Typedefs

typedef char | dgInt8
typedef unsigned char | dgUnsigned8
typedef short | dgInt16
typedef unsigned short | dgUnsigned16
typedef int | dgInt32
typedef unsigned | dgUnsigned32
typedef long long | dgInt64
typedef unsigned long long | dgUnsigned64
typedef double | dgFloat64
typedef float | dgFloat32
typedef void(dgApi * | dgDeserialize) (void *const userData, void *buffer, size_t size)
typedef void(dgApi * | dgSerialize) (void *const userData, const void *const buffer, size_t size)
typedef bool(dgApi * | dgReportProgress) (dgFloat32 progressNormalzedPercent, void *const userData)
typedef dgUnsigned32(dgApi * | OnGetPerformanceCountCallback) ()

## Functions

DG_INLINE dgInt32 | dgExp2 (dgInt32 x)
template<class T >
DG_INLINE T | dgMin (T A, T B)
template<class T >
DG_INLINE T | dgMax (T A, T B)
template<class T >
DG_INLINE T | dgMin (T A, T B, T C)
template<class T >
DG_INLINE T | dgMax (T A, T B, T C)
template<class T >
DG_INLINE T | dgClamp (T val, T min, T max)
template<class T >
DG_INLINE void | dgSwap (T &A, T &B)
template<class T >
DG_INLINE T | dgSign (T A)
template<class T >
dgInt32 | dgBinarySearch (T const *array, dgInt32 elements, dgInt32 entry)
template<class T >
void | dgRadixSort (T *const array, T *const tmpArray, dgInt32 elements, dgInt32 radixPass, dgInt32(*getRadixKey)(const T *const A, void *const context), void *const context=NULL)
template<class T >
void | dgSort (T *const array, dgInt32 elements, dgInt32(*compare)(const T *const A, const T *const B, void *const context), void *const context=NULL)
template<class T >
void | dgSortIndirect (T **const array, dgInt32 elements, dgInt32(*compare)(const T *const A, const T *const B, void *const context), void *const context=NULL)
void | GetMinMax (dgVector &Min, dgVector &Max, const dgFloat32 *const vArray, dgInt32 vCount, dgInt32 StrideInBytes)
void | GetMinMax (dgBigVector &Min, dgBigVector &Max, const dgFloat64 *const vArray, dgInt32 vCount, dgInt32 strideInBytes)
dgInt32 | dgVertexListToIndexList (dgFloat32 *const vertexList, dgInt32 strideInBytes, dgInt32 floatSizeInBytes, dgInt32 unsignedSizeInBytes, dgInt32 vertexCount, dgInt32 *const indexListOut, dgFloat32 tolerance=dgEPSILON)
dgInt32 | dgVertexListToIndexList (dgFloat64 *const vertexList, dgInt32 strideInBytes, dgInt32 compareCount, dgInt32 vertexCount, dgInt32 *const indexListOut, dgFloat64 tolerance=dgEPSILON)
DG_INLINE dgFloat32 | dgAbsf (dgFloat32 x)
DG_INLINE dgInt32 | dgFastInt (dgFloat64 x)
DG_INLINE dgInt32 | dgFastInt (dgFloat32 x)
DG_INLINE dgFloat32 | dgFloor (dgFloat32 x)
DG_INLINE dgFloat32 | dgCeil (dgFloat32 x)
DG_INLINE dgFloat32 | dgRsqrt (dgFloat32 x)
void | dgSerializeMarker (dgSerialize serializeCallback, void *const userData)
void | dgDeserializeMarker (dgDeserialize serializeCallback, void *const userData)
dgUnsigned64 | dgGetTimeInMicrosenconds ()
DG_INLINE dgInt32 | dgAtomicExchangeAndAdd (dgInt32 *const addend, dgInt32 amount)
DG_INLINE dgInt32 | dgInterlockedExchange (dgInt32 *const ptr, dgInt32 value)
DG_INLINE void | dgThreadYield ()
DG_INLINE void | dgPrefetchMem (const void *const mem)

## Macro Definition Documentation

## § _stricmp

#define _stricmp | ( |  | x,
|  |  | y
| ) |  | strcasecmp(x,y)

## § DG_GCC_VECTOR_ALIGMENT

dgContact DG_GCC_VECTOR_ALIGMENT __attribute__ ((aligned (DG_VECTOR_SIMD_SIZE)))

## § DG_INLINE

#define DG_INLINE inline

## § DG_MAX_THREADS_HIVE_COUNT

#define DG_MAX_THREADS_HIVE_COUNT 16

## § DG_MSC_VECTOR_ALIGMENT

#define DG_MSC_VECTOR_ALIGMENT

## § DG_VECTOR_SIMD_SIZE

#define DG_VECTOR_SIMD_SIZE 16

## § dgAcos

#define dgAcos | ( |  | x | ) | dgFloat32 (acos(x))

## § dgApi

#define dgApi

## § dgAsin

#define dgAsin | ( |  | x | ) | dgFloat32 (asin(x))

## § dgAssert

#define dgAssert | ( |  | x | ) |

## § dgAtan2

#define dgAtan2 | ( |  | x,
|  |  | y
| ) |  | dgFloat32 (atan2(x,y))

## § dgCheckFloat

#define dgCheckFloat | ( |  | x | ) | (isfinite(x) && !isnan(x))

## § dgClearFP

#define dgClearFP | ( |  | ) | _clearfp()

## § dgControlFP

#define dgControlFP | ( |  | x,
|  |  | y
| ) |  | _controlfp(x,y)

## § dgCos

#define dgCos | ( |  | x | ) | dgFloat32 (cos(x))

## § dgDEG2RAD

#define dgDEG2RAD dgFloat32 (dgPI / 180.0f)

## § dgEPSILON

#define dgEPSILON dgFloat32 (1.0e-5f)

## § dgEXP

#define dgEXP dgFloat32 (2.71828f)

## § dgFmod

#define dgFmod | ( |  | x,
|  |  | y
| ) |  | dgFloat32 (fmod(x,y))

## § dgGRAVITY

#define dgGRAVITY dgFloat32 (9.8f)

## § dgKMH2MPSEC

#define dgKMH2MPSEC dgFloat32 (0.278f)

## § dgLog

#define dgLog | ( |  | x | ) | dgFloat32 (log(x))

## § dgPI

#define dgPI dgFloat32 (3.14159f)

## § dgPI2

#define dgPI2 dgFloat32 (dgPI * 2.0f)

## § dgPow

#define dgPow | ( |  | x,
|  |  | y
| ) |  | dgFloat32 (pow(x,y))

## § dgRAD2DEG

#define dgRAD2DEG dgFloat32 (180.0f / dgPI)

## § dgSin

#define dgSin | ( |  | x | ) | dgFloat32 (sin(x))

## § dgSqrt

#define dgSqrt | ( |  | x | ) | dgFloat32 (sqrt(x))

## § dgStdApi

#define dgStdApi

## § IntToPointer

#define IntToPointer | ( |  | x | ) | ((void*)(size_t(x)))

## § PointerToInt

#define PointerToInt | ( |  | x | ) | ((size_t)x)

## Typedef Documentation

## § dgDeserialize

typedef void(dgApi * dgDeserialize) (void *const userData, void *buffer, size_t size)

## § dgFloat32

typedef float dgFloat32

## § dgFloat64

typedef double dgFloat64

## § dgInt16

typedef short dgInt16

## § dgInt32

typedef int dgInt32

## § dgInt64

typedef long long dgInt64

## § dgInt8

typedef char dgInt8

## § dgReportProgress

typedef bool(dgApi * dgReportProgress) (dgFloat32 progressNormalzedPercent, void *const userData)

## § dgSerialize

typedef void(dgApi * dgSerialize) (void *const userData, const void *const buffer, size_t size)

## § dgUnsigned16

typedef unsigned short dgUnsigned16

## § dgUnsigned32

typedef unsigned int dgUnsigned32

## § dgUnsigned64

typedef unsigned long long dgUnsigned64

## § dgUnsigned8

typedef unsigned char dgUnsigned8

## § OnGetPerformanceCountCallback

typedef dgUnsigned32(dgApi * OnGetPerformanceCountCallback) ()

## Function Documentation

## § dgAbsf()

DG_INLINE dgFloat32 dgAbsf | ( | dgFloat32 | x | ) |

## § dgAtomicExchangeAndAdd()

DG_INLINE dgInt32 dgAtomicExchangeAndAdd | ( | dgInt32 *const | addend,
|  | dgInt32 | amount
| ) |  |

## § dgBinarySearch()

template<class T >

dgInt32 dgBinarySearch | ( | T const * | array,
|  | dgInt32 | elements,
|  | dgInt32 | entry
| ) |  |

## § dgCeil()

DG_INLINE dgFloat32 dgCeil | ( | dgFloat32 | x | ) |

## § dgClamp()

template<class T >

DG_INLINE T dgClamp | ( | T | val,
|  | T | min,
|  | T | max
| ) |  |

## § dgDeserializeMarker()

void dgDeserializeMarker | ( | dgDeserialize | serializeCallback,
|  | void *const | userData
| ) |  |

## § dgExp2()

DG_INLINE dgInt32 dgExp2 | ( | dgInt32 | x | ) |

## § dgFastInt() [1/2]

DG_INLINE dgInt32 dgFastInt | ( | dgFloat64 | x | ) |

## § dgFastInt() [2/2]

DG_INLINE dgInt32 dgFastInt | ( | dgFloat32 | x | ) |

## § dgFloor()

DG_INLINE dgFloat32 dgFloor | ( | dgFloat32 | x | ) |

## § dgGetTimeInMicrosenconds()

dgUnsigned64 dgGetTimeInMicrosenconds | ( |  | ) |

## § dgInterlockedExchange()

DG_INLINE dgInt32 dgInterlockedExchange | ( | dgInt32 *const | ptr,
|  | dgInt32 | value
| ) |  |

## § dgMax() [1/2]

template<class T >

DG_INLINE T dgMax | ( | T | A,
|  | T | B
| ) |  |

## § dgMax() [2/2]

template<class T >

DG_INLINE T dgMax | ( | T | A,
|  | T | B,
|  | T | C
| ) |  |

## § dgMin() [1/2]

template<class T >

DG_INLINE T dgMin | ( | T | A,
|  | T | B
| ) |  |

## § dgMin() [2/2]

template<class T >

DG_INLINE T dgMin | ( | T | A,
|  | T | B,
|  | T | C
| ) |  |

## § dgPrefetchMem()

DG_INLINE void dgPrefetchMem | ( | const void *const | mem | ) |

## § dgRadixSort()

template<class T >

void dgRadixSort | ( | T *const | array,
|  | T *const | tmpArray,
|  | dgInt32 | elements,
|  | dgInt32 | radixPass,
|  | dgInt32(*)(const T *const A, void *const context) | getRadixKey,
|  | void *const | context = `NULL`
| ) |  |

## § dgRsqrt()

DG_INLINE dgFloat32 dgRsqrt | ( | dgFloat32 | x | ) |

## § dgSerializeMarker()

void dgSerializeMarker | ( | dgSerialize | serializeCallback,
|  | void *const | userData
| ) |  |

## § dgSign()

template<class T >

DG_INLINE T dgSign | ( | T | A | ) |

## § dgSort()

template<class T >

void dgSort | ( | T *const | array,
|  | dgInt32 | elements,
|  | dgInt32(*)(const T *const A, const T *const B, void *const context) | compare,
|  | void *const | context = `NULL`
| ) |  |

## § dgSortIndirect()

template<class T >

void dgSortIndirect | ( | T **const | array,
|  | dgInt32 | elements,
|  | dgInt32(*)(const T *const A, const T *const B, void *const context) | compare,
|  | void *const | context = `NULL`
| ) |  |

## § dgSwap()

template<class T >

DG_INLINE void dgSwap | ( | T & | A,
|  | T & | B
| ) |  |

## § dgThreadYield()

DG_INLINE void dgThreadYield | ( |  | ) |

## § dgVertexListToIndexList() [1/2]

dgInt32 dgVertexListToIndexList | ( | dgFloat32 *const | vertexList,
|  | dgInt32 | strideInBytes,
|  | dgInt32 | floatSizeInBytes,
|  | dgInt32 | unsignedSizeInBytes,
|  | dgInt32 | vertexCount,
|  | dgInt32 *const | indexListOut,
|  | dgFloat32 | tolerance = `dgEPSILON`
| ) |  |

## § dgVertexListToIndexList() [2/2]

dgInt32 dgVertexListToIndexList | ( | dgFloat64 *const | vertexList,
|  | dgInt32 | strideInBytes,
|  | dgInt32 | compareCount,
|  | dgInt32 | vertexCount,
|  | dgInt32 *const | indexListOut,
|  | dgFloat64 | tolerance = `dgEPSILON`
| ) |  |

## § GetMinMax() [1/2]

void GetMinMax | ( | dgVector & | Min,
|  | dgVector & | Max,
|  | const dgFloat32 *const | vArray,
|  | dgInt32 | vCount,
|  | dgInt32 | StrideInBytes
| ) |  |

## § GetMinMax() [2/2]

void GetMinMax | ( | dgBigVector & | Min,
|  | dgBigVector & | Max,
|  | const dgFloat64 *const | vArray,
|  | dgInt32 | vCount,
|  | dgInt32 | strideInBytes
| ) |  |