24 #ifndef PXR_BASE_ARCH_MATH_H
25 #define PXR_BASE_ARCH_MATH_H
35 #if defined(ARCH_COMPILER_MSVC)
41 #define M_PI 3.14159265358979323846
49 #if defined (ARCH_CPU_INTEL) || defined (ARCH_CPU_ARM) || defined (doxygen)
53 #define ARCH_MIN_FLOAT_EPS_SQR 0.000244141F
56 inline long ArchSign(
long val) {
57 return (val > 0) - (val < 0);
62 inline uint32_t ArchFloatToBitPattern(
float v) {
73 inline float ArchBitPatternToFloat(uint32_t
v) {
84 inline uint64_t ArchDoubleToBitPattern(
double v) {
95 inline double ArchBitPatternToDouble(uint64_t
v) {
101 return value._double;
105 #error Unknown system architecture.
108 #if defined(ARCH_OS_LINUX) || defined(doxygen)
111 inline void ArchSinCosf(
float v,
float *
s,
float *
c) {
sincosf(v, s, c); }
114 inline void ArchSinCos(
double v,
double *
s,
double *
c) {
sincos(v, s, c); }
116 #elif defined(ARCH_OS_DARWIN) || defined(ARCH_OS_WINDOWS)
118 inline void ArchSinCosf(
float v,
float *
s,
float *
c) {
122 inline void ArchSinCos(
double v,
double *
s,
double *
c) {
128 #error Unknown architecture.
137 #if defined(ARCH_COMPILER_GCC) || defined(ARCH_COMPILER_CLANG)
138 return __builtin_ctzl(x);
139 #elif defined(ARCH_COMPILER_MSVC)
141 _BitScanForward64(&index, x);
145 x = (x ^ (x - 1)) >> 1;
159 #endif // PXR_BASE_ARCH_MATH_H
SYS_API double cos(double x)
int ArchCountTrailingZeros(uint64_t x)
GLsizei const GLfloat * value
OIIO_HOSTDEVICE void sincos(float x, float *sine, float *cosine)
SYS_API void sincosf(float x, float *s, float *c)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
#define PXR_NAMESPACE_CLOSE_SCOPE
SYS_API double sin(double x)