HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SYS_FPUMath.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: SYS_FPUMath.h (SYS Library, C++)
7  *
8  * COMMENTS: Prototypes for FPU implementations of math functions.
9  * These are intentionally named with non-standard names,
10  * because they have different signatures.
11  */
12 
13 #pragma once
14 
15 #include "SYS_API.h"
16 #include "SYS_Inline.h"
17 
18 #if defined(LINUX)
19 // This is actually here because Mac expects the assembly functions to have
20 // underscore prefixes, and Linux and Mac use the same assembly file.
21 #define NAME_WRAP(x) _##x
22 #else
23 #define NAME_WRAP(x) x
24 #endif
25 
26 extern "C" {
27 
28 SYS_API void NAME_WRAP(cos_fpu_f)(float* in_out);
29 SYS_API void NAME_WRAP(cos_fpu_d)(double* in_out);
30 SYS_API void NAME_WRAP(sin_fpu_f)(float* in_out);
31 SYS_API void NAME_WRAP(sin_fpu_d)(double* in_out);
32 SYS_API void NAME_WRAP(cos_and_sin_fpu_f)(const float* in, float out[2]);
33 SYS_API void NAME_WRAP(cos_and_sin_fpu_d)(const double* in, double out[2]);
34 SYS_API void NAME_WRAP(tan_fpu_f)(float* in_out);
35 SYS_API void NAME_WRAP(tan_fpu_d)(double* in_out);
36 SYS_API void NAME_WRAP(atan_fpu_f)(float* in_out);
37 SYS_API void NAME_WRAP(atan_fpu_d)(double* in_out);
38 SYS_API void NAME_WRAP(atan2_fpu_f)(const float in[2], float* out);
39 SYS_API void NAME_WRAP(atan2_fpu_d)(const double in[2], double* out);
40 SYS_API void NAME_WRAP(asin_fpu_f)(float* in_out);
41 SYS_API void NAME_WRAP(asin_fpu_d)(double* in_out);
42 SYS_API void NAME_WRAP(acos_fpu_f)(float* in_out);
43 SYS_API void NAME_WRAP(acos_fpu_d)(double* in_out);
44 SYS_API void NAME_WRAP(fmod_fpu_f)(const float in[2], float* out);
45 SYS_API void NAME_WRAP(fmod_fpu_d)(const double in[2], double* out);
46 SYS_API void NAME_WRAP(log_fpu_f)(float* in_out);
47 SYS_API void NAME_WRAP(log_fpu_d)(double* in_out);
48 SYS_API void NAME_WRAP(log10_fpu_f)(float* in_out);
49 SYS_API void NAME_WRAP(log10_fpu_d)(double* in_out);
50 SYS_API void NAME_WRAP(log2_fpu_f)(float* in_out);
51 SYS_API void NAME_WRAP(log2_fpu_d)(double* in_out);
52 SYS_API void NAME_WRAP(log1p_fpu_f)(float* in_out);
53 SYS_API void NAME_WRAP(log1p_fpu_d)(double* in_out);
54 SYS_API void NAME_WRAP(expm1_fpu_f)(float* in_out);
55 SYS_API void NAME_WRAP(expm1_fpu_d)(double* in_out);
56 SYS_API void NAME_WRAP(exp_fpu_f)(float* in_out);
57 SYS_API void NAME_WRAP(exp_fpu_d)(double* in_out);
58 SYS_API void NAME_WRAP(exp2_fpu_f)(float* in_out);
59 SYS_API void NAME_WRAP(exp2_fpu_d)(double* in_out);
60 SYS_API void NAME_WRAP(pow_fpu_f)(const float in[2], float* out);
61 SYS_API void NAME_WRAP(pow_fpu_d)(const double in[2], double* out);
62 SYS_API void NAME_WRAP(tanh_fpu_f)(float* in_out);
63 SYS_API void NAME_WRAP(tanh_fpu_d)(double* in_out);
64 
65 }
66 
67 namespace fpu {
68 SYS_FORCE_INLINE float cos(float x) { NAME_WRAP(cos_fpu_f)(&x); return x; }
69 SYS_FORCE_INLINE double cos(double x) { NAME_WRAP(cos_fpu_d)(&x); return x; }
70 SYS_FORCE_INLINE float sin(float x) { NAME_WRAP(sin_fpu_f)(&x); return x; }
71 SYS_FORCE_INLINE double sin(double x) { NAME_WRAP(sin_fpu_d)(&x); return x; }
72 SYS_FORCE_INLINE void cos_and_sin(float x, float out[2]) { NAME_WRAP(cos_and_sin_fpu_f)(&x,out); }
73 SYS_FORCE_INLINE void cos_and_sin(double x, double out[2]) { NAME_WRAP(cos_and_sin_fpu_d)(&x,out); }
74 SYS_FORCE_INLINE float tan(float x) { NAME_WRAP(tan_fpu_f)(&x); return x; }
75 SYS_FORCE_INLINE double tan(double x) { NAME_WRAP(tan_fpu_d)(&x); return x; }
76 SYS_FORCE_INLINE float atan(float x) { NAME_WRAP(atan_fpu_f)(&x); return x; }
77 SYS_FORCE_INLINE double atan(double x) { NAME_WRAP(atan_fpu_d)(&x); return x; }
78 SYS_FORCE_INLINE float atan2(float y, float x) { float in[2] = {y,x}; float out; NAME_WRAP(atan2_fpu_f)(in,&out); return out; }
79 SYS_FORCE_INLINE double atan2(double y, double x) { double in[2] = {y,x}; double out; NAME_WRAP(atan2_fpu_d)(in,&out); return out; }
80 SYS_FORCE_INLINE float asin(float x) { NAME_WRAP(asin_fpu_f)(&x); return x; }
81 SYS_FORCE_INLINE double asin(double x) { NAME_WRAP(asin_fpu_d)(&x); return x; }
82 SYS_FORCE_INLINE float acos(float x) { NAME_WRAP(acos_fpu_f)(&x); return x; }
83 SYS_FORCE_INLINE double acos(double x) { NAME_WRAP(acos_fpu_d)(&x); return x; }
84 SYS_FORCE_INLINE float fmod(float numer, float denom) { float in[2] = {numer,denom}; float out; NAME_WRAP(fmod_fpu_f)(in,&out); return out; }
85 SYS_FORCE_INLINE double fmod(double numer, double denom) { double in[2] = {numer,denom}; double out; NAME_WRAP(fmod_fpu_d)(in,&out); return out; }
86 SYS_FORCE_INLINE float log(float x) { NAME_WRAP(log_fpu_f)(&x); return x; }
87 SYS_FORCE_INLINE double log(double x) { NAME_WRAP(log_fpu_d)(&x); return x; }
88 SYS_FORCE_INLINE float log10(float x) { NAME_WRAP(log10_fpu_f)(&x); return x; }
89 SYS_FORCE_INLINE double log10(double x) { NAME_WRAP(log10_fpu_d)(&x); return x; }
90 SYS_FORCE_INLINE float log2(float x) { NAME_WRAP(log2_fpu_f)(&x); return x; }
91 SYS_FORCE_INLINE double log2(double x) { NAME_WRAP(log2_fpu_d)(&x); return x; }
92 SYS_FORCE_INLINE float log1p(float x) { NAME_WRAP(log1p_fpu_f)(&x); return x; }
93 SYS_FORCE_INLINE double log1p(double x) { NAME_WRAP(log1p_fpu_d)(&x); return x; }
94 SYS_FORCE_INLINE float expm1(float x) { NAME_WRAP(expm1_fpu_f)(&x); return x; }
95 SYS_FORCE_INLINE double expm1(double x) { NAME_WRAP(expm1_fpu_d)(&x); return x; }
96 SYS_FORCE_INLINE float exp(float x) { NAME_WRAP(exp_fpu_f)(&x); return x; }
97 SYS_FORCE_INLINE double exp(double x) { NAME_WRAP(exp_fpu_d)(&x); return x; }
98 SYS_FORCE_INLINE float exp2(float x) { NAME_WRAP(exp2_fpu_f)(&x); return x; }
99 SYS_FORCE_INLINE double exp2(double x) { NAME_WRAP(exp2_fpu_d)(&x); return x; }
100 SYS_FORCE_INLINE float pow(float base, float exponent) { float in[2] = {base,exponent}; float out; NAME_WRAP(pow_fpu_f)(in,&out); return out; }
101 SYS_FORCE_INLINE double pow(double base,double exponent) { double in[2] = {base,exponent}; double out; NAME_WRAP(pow_fpu_d)(in,&out); return out; }
102 SYS_FORCE_INLINE float tanh(float x) { NAME_WRAP(tanh_fpu_f)(&x); return x; }
103 SYS_FORCE_INLINE double tanh(double x) { NAME_WRAP(tanh_fpu_d)(&x); return x; }
104 }
105 
106 #undef NAME_WRAP
SYS_API void NAME_WRAP() fmod_fpu_f(const float in[2], float *out)
SYS_API void NAME_WRAP() acos_fpu_d(double *in_out)
SYS_API void NAME_WRAP() log2_fpu_f(float *in_out)
SYS_FORCE_INLINE float log(float x)
Definition: SYS_FPUMath.h:86
SYS_API void NAME_WRAP() asin_fpu_d(double *in_out)
SYS_API void NAME_WRAP() pow_fpu_d(const double in[2], double *out)
SYS_API void NAME_WRAP() log_fpu_d(double *in_out)
SYS_API void NAME_WRAP() tanh_fpu_d(double *in_out)
SYS_FORCE_INLINE float tan(float x)
Definition: SYS_FPUMath.h:74
SYS_API void NAME_WRAP() log10_fpu_d(double *in_out)
SYS_FORCE_INLINE float log1p(float x)
Definition: SYS_FPUMath.h:92
SYS_API void NAME_WRAP() log2_fpu_d(double *in_out)
SYS_API void NAME_WRAP() atan2_fpu_f(const float in[2], float *out)
SYS_API void NAME_WRAP() log_fpu_f(float *in_out)
SYS_API void NAME_WRAP() exp_fpu_f(float *in_out)
SYS_API void NAME_WRAP() exp_fpu_d(double *in_out)
SYS_FORCE_INLINE float cos(float x)
Definition: SYS_FPUMath.h:68
SYS_API void NAME_WRAP() exp2_fpu_f(float *in_out)
SYS_FORCE_INLINE float expm1(float x)
Definition: SYS_FPUMath.h:94
SYS_FORCE_INLINE void cos_and_sin(float x, float out[2])
Definition: SYS_FPUMath.h:72
SYS_API void NAME_WRAP() expm1_fpu_d(double *in_out)
SYS_FORCE_INLINE float exp(float x)
Definition: SYS_FPUMath.h:96
SYS_API void NAME_WRAP() cos_fpu_d(double *in_out)
#define NAME_WRAP(x)
Definition: SYS_FPUMath.h:23
SYS_FORCE_INLINE float atan(float x)
Definition: SYS_FPUMath.h:76
SYS_FORCE_INLINE float acos(float x)
Definition: SYS_FPUMath.h:82
GLint GLint GLint GLint GLint x
Definition: glew.h:1252
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1252
GLuint in
Definition: glew.h:11510
SYS_API void NAME_WRAP() expm1_fpu_f(float *in_out)
SYS_API void NAME_WRAP() fmod_fpu_d(const double in[2], double *out)
SYS_API void NAME_WRAP() tan_fpu_d(double *in_out)
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
SYS_FORCE_INLINE float pow(float base, float exponent)
Definition: SYS_FPUMath.h:100
SYS_API void NAME_WRAP() exp2_fpu_d(double *in_out)
SYS_API void NAME_WRAP() atan2_fpu_d(const double in[2], double *out)
SYS_API void NAME_WRAP() atan_fpu_f(float *in_out)
SYS_FORCE_INLINE float log2(float x)
Definition: SYS_FPUMath.h:90
SYS_API void NAME_WRAP() sin_fpu_f(float *in_out)
SYS_API void NAME_WRAP() cos_and_sin_fpu_f(const float *in, float out[2])
SYS_FORCE_INLINE float log10(float x)
Definition: SYS_FPUMath.h:88
SYS_API void NAME_WRAP() sin_fpu_d(double *in_out)
SYS_FORCE_INLINE float fmod(float numer, float denom)
Definition: SYS_FPUMath.h:84
SYS_API void NAME_WRAP() pow_fpu_f(const float in[2], float *out)
SYS_FORCE_INLINE float asin(float x)
Definition: SYS_FPUMath.h:80
SYS_API void NAME_WRAP() log1p_fpu_f(float *in_out)
SYS_API void NAME_WRAP() cos_fpu_f(float *in_out)
SYS_FORCE_INLINE float atan2(float y, float x)
Definition: SYS_FPUMath.h:78
SYS_API void NAME_WRAP() log10_fpu_f(float *in_out)
SYS_API void NAME_WRAP() tan_fpu_f(float *in_out)
SYS_API void NAME_WRAP() atan_fpu_d(double *in_out)
SYS_API void NAME_WRAP() cos_and_sin_fpu_d(const double *in, double out[2])
#define SYS_API
Definition: SYS_API.h:11
SYS_API void NAME_WRAP() log1p_fpu_d(double *in_out)
SYS_API void NAME_WRAP() asin_fpu_f(float *in_out)
SYS_FORCE_INLINE float exp2(float x)
Definition: SYS_FPUMath.h:98
SYS_API void NAME_WRAP() acos_fpu_f(float *in_out)
SYS_FORCE_INLINE float sin(float x)
Definition: SYS_FPUMath.h:70
SYS_API void NAME_WRAP() tanh_fpu_f(float *in_out)
SYS_FORCE_INLINE float tanh(float x)
Definition: SYS_FPUMath.h:102