blob: 1ff074a720c752310dde76de6e15355b436acdb8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
#include <math.h>
#include <stdint.h>
float fabsf(float x)
{
// XXX EMSCRIPTEN: use the wasm instruction via clang builtin
// See https://github.com/emscripten-core/emscripten/issues/9236
#ifdef __wasm__
return __builtin_fabsf(x);
#else
union {float f; uint32_t i;} u = {x};
u.i &= 0x7fffffff;
return u.f;
#endif
}
|