95 |
// conversion using truncate |
// conversion using truncate |
96 |
inline static int Int(const float a) { |
inline static int Int(const float a) { |
97 |
switch (IMPL) { |
switch (IMPL) { |
|
case CPP: { |
|
|
return (int) a; |
|
|
} |
|
98 |
#if CONFIG_ASM && ARCH_X86 |
#if CONFIG_ASM && ARCH_X86 |
99 |
case ASM_X86_MMX_SSE: { |
case ASM_X86_MMX_SSE: { |
100 |
int ret; |
int ret; |
106 |
return ret; |
return ret; |
107 |
} |
} |
108 |
#endif // CONFIG_ASM && ARCH_X86 |
#endif // CONFIG_ASM && ARCH_X86 |
109 |
|
default: { |
110 |
|
return (int) a; |
111 |
|
} |
112 |
} |
} |
113 |
} |
} |
114 |
|
|
119 |
|
|
120 |
inline static float Float(const int a) { |
inline static float Float(const int a) { |
121 |
switch (IMPL) { |
switch (IMPL) { |
|
case CPP: { |
|
|
return (float) a; |
|
|
} |
|
122 |
#if CONFIG_ASM && ARCH_X86 |
#if CONFIG_ASM && ARCH_X86 |
123 |
case ASM_X86_MMX_SSE: { |
case ASM_X86_MMX_SSE: { |
124 |
float ret; |
float ret; |
131 |
return ret; |
return ret; |
132 |
} |
} |
133 |
#endif // CONFIG_ASM && ARCH_X86 |
#endif // CONFIG_ASM && ARCH_X86 |
134 |
|
default: { |
135 |
|
return (float) a; |
136 |
|
} |
137 |
} |
} |
138 |
} |
} |
139 |
|
|
146 |
|
|
147 |
inline static float Sum(const float& a, const float& b) { |
inline static float Sum(const float& a, const float& b) { |
148 |
switch (IMPL) { |
switch (IMPL) { |
|
case CPP: { |
|
|
return (a + b); |
|
|
} |
|
149 |
#if CONFIG_ASM && ARCH_X86 |
#if CONFIG_ASM && ARCH_X86 |
150 |
case ASM_X86_MMX_SSE: { |
case ASM_X86_MMX_SSE: { |
151 |
float ret; |
float ret; |
159 |
return ret; |
return ret; |
160 |
} |
} |
161 |
#endif // CONFIG_ASM && ARCH_X86 |
#endif // CONFIG_ASM && ARCH_X86 |
162 |
|
default: { |
163 |
|
return (a + b); |
164 |
|
} |
165 |
} |
} |
166 |
} |
} |
167 |
|
|
171 |
|
|
172 |
inline static float Sub(const float& a, const float& b) { |
inline static float Sub(const float& a, const float& b) { |
173 |
switch (IMPL) { |
switch (IMPL) { |
|
case CPP: { |
|
|
return (a - b); |
|
|
} |
|
174 |
#if CONFIG_ASM && ARCH_X86 |
#if CONFIG_ASM && ARCH_X86 |
175 |
case ASM_X86_MMX_SSE: { |
case ASM_X86_MMX_SSE: { |
176 |
float ret; |
float ret; |
184 |
return ret; |
return ret; |
185 |
} |
} |
186 |
#endif // CONFIG_ASM && ARCH_X86 |
#endif // CONFIG_ASM && ARCH_X86 |
187 |
|
default: { |
188 |
|
return (a - b); |
189 |
|
} |
190 |
} |
} |
191 |
} |
} |
192 |
|
|
196 |
|
|
197 |
inline static float Mul(const float a, const float b) { |
inline static float Mul(const float a, const float b) { |
198 |
switch (IMPL) { |
switch (IMPL) { |
|
case CPP: { |
|
|
return (a * b); |
|
|
} |
|
199 |
#if CONFIG_ASM && ARCH_X86 |
#if CONFIG_ASM && ARCH_X86 |
200 |
case ASM_X86_MMX_SSE: { |
case ASM_X86_MMX_SSE: { |
201 |
float ret; |
float ret; |
209 |
return ret; |
return ret; |
210 |
} |
} |
211 |
#endif // CONFIG_ASM && ARCH_X86 |
#endif // CONFIG_ASM && ARCH_X86 |
212 |
|
default: { |
213 |
|
return (a * b); |
214 |
|
} |
215 |
} |
} |
216 |
} |
} |
217 |
|
|
221 |
|
|
222 |
inline static float Div(const float a, const float b) { |
inline static float Div(const float a, const float b) { |
223 |
switch (IMPL) { |
switch (IMPL) { |
|
case CPP: { |
|
|
return (a / b); |
|
|
} |
|
224 |
#if CONFIG_ASM && ARCH_X86 |
#if CONFIG_ASM && ARCH_X86 |
225 |
case ASM_X86_MMX_SSE: { |
case ASM_X86_MMX_SSE: { |
226 |
float ret; |
float ret; |
234 |
return ret; |
return ret; |
235 |
} |
} |
236 |
#endif // CONFIG_ASM && ARCH_X86 |
#endif // CONFIG_ASM && ARCH_X86 |
237 |
|
default: { |
238 |
|
return (a / b); |
239 |
|
} |
240 |
} |
} |
241 |
} |
} |
242 |
|
|
246 |
|
|
247 |
inline static float Min(const float a, const float b) { |
inline static float Min(const float a, const float b) { |
248 |
switch (IMPL) { |
switch (IMPL) { |
|
case CPP: { |
|
|
return (b < a) ? b : a; |
|
|
} |
|
249 |
#if CONFIG_ASM && ARCH_X86 |
#if CONFIG_ASM && ARCH_X86 |
250 |
case ASM_X86_MMX_SSE: { |
case ASM_X86_MMX_SSE: { |
251 |
float ret; |
float ret; |
259 |
return ret; |
return ret; |
260 |
} |
} |
261 |
#endif // CONFIG_ASM && ARCH_X86 |
#endif // CONFIG_ASM && ARCH_X86 |
262 |
|
default: { |
263 |
|
return (b < a) ? b : a; |
264 |
|
} |
265 |
} |
} |
266 |
} |
} |
267 |
|
|
271 |
|
|
272 |
inline static float Max(const float a, const float b) { |
inline static float Max(const float a, const float b) { |
273 |
switch (IMPL) { |
switch (IMPL) { |
|
case CPP: { |
|
|
return (b > a) ? b : a; |
|
|
} |
|
274 |
#if CONFIG_ASM && ARCH_X86 |
#if CONFIG_ASM && ARCH_X86 |
275 |
case ASM_X86_MMX_SSE: { |
case ASM_X86_MMX_SSE: { |
276 |
float ret; |
float ret; |
284 |
return ret; |
return ret; |
285 |
} |
} |
286 |
#endif // CONFIG_ASM && ARCH_X86 |
#endif // CONFIG_ASM && ARCH_X86 |
287 |
|
default: { |
288 |
|
return (b > a) ? b : a; |
289 |
|
} |
290 |
} |
} |
291 |
} |
} |
292 |
|
|
296 |
|
|
297 |
inline static float Fmodf(const float &a, const float &b) { |
inline static float Fmodf(const float &a, const float &b) { |
298 |
switch (IMPL) { |
switch (IMPL) { |
|
case CPP: { |
|
|
return fmodf(a, b); |
|
|
} |
|
299 |
#if CONFIG_ASM && ARCH_X86 |
#if CONFIG_ASM && ARCH_X86 |
300 |
case ASM_X86_MMX_SSE: { |
case ASM_X86_MMX_SSE: { |
301 |
float ret; |
float ret; |
316 |
return ret; |
return ret; |
317 |
} |
} |
318 |
#endif // CONFIG_ASM && ARCH_X86 |
#endif // CONFIG_ASM && ARCH_X86 |
319 |
|
default: { |
320 |
|
return fmodf(a, b); |
321 |
|
} |
322 |
} |
} |
323 |
} |
} |
324 |
}; |
}; |