17#if defined(ARCH_COMPILER_MSVC)
23#define M_PI 3.14159265358979323846
28#if defined (ARCH_CPU_INTEL) || defined (ARCH_CPU_ARM) || defined (doxygen)
32#define ARCH_MIN_FLOAT_EPS_SQR 0.000244141F
36 return (val > 0) - (val < 0);
84#error Unknown system architecture.
87#if defined(ARCH_OS_LINUX) || defined(doxygen)
90inline void ArchSinCosf(
float v,
float *s,
float *c) { sincosf(v, s, c); }
93inline void ArchSinCos(
double v,
double *s,
double *c) { sincos(v, s, c); }
95#elif defined(ARCH_OS_DARWIN) || defined(ARCH_OS_WINDOWS)
97inline void ArchSinCosf(
float v,
float *s,
float *c) {
101inline void ArchSinCos(
double v,
double *s,
double *c) {
107#error Unknown architecture.
116#if defined(ARCH_COMPILER_GCC) || defined(ARCH_COMPILER_CLANG)
117 return __builtin_ctzl(x);
118#elif defined(ARCH_COMPILER_MSVC)
120 _BitScanForward64(&index, x);
124 x = (x ^ (x - 1)) >> 1;
uint32_t ArchFloatToBitPattern(float v)
Returns The IEEE-754 bit pattern of the specified single precision value as a 32-bit unsigned integer...
Definition math.h:41
uint64_t ArchDoubleToBitPattern(double v)
Returns The IEEE-754 bit pattern of the specified double precision value as a 64-bit unsigned integer...
Definition math.h:63
double ArchBitPatternToDouble(uint64_t v)
Returns The double precision floating point value corresponding to the given IEEE-754 bit pattern.
Definition math.h:74
long ArchSign(long val)
Three-valued sign. Return 1 if val > 0, 0 if val == 0, or -1 if val < 0.
Definition math.h:35
void ArchSinCos(double v, double *s, double *c)
Computes the sine and cosine of the specified value as a double.
Definition math.h:93
void ArchSinCosf(float v, float *s, float *c)
Computes the sine and cosine of the specified value as a float.
Definition math.h:90
float ArchBitPatternToFloat(uint32_t v)
Returns The single precision floating point value corresponding to the given IEEE-754 bit pattern.
Definition math.h:52
int ArchCountTrailingZeros(uint64_t x)
Return the number of consecutive 0-bits in x starting from the least significant bit position.
Definition math.h:114