Sign in
android
/
platform
/
external
/
musl
/
3da2b5cceae98f5098e62e7865fe6433c1e82775
/
.
/
src
/
math
/
x86_64
/
fabs.c
blob: 1656247770f778aba56e0620adbc3e8241a3e8ea [
file
] [
log
] [
blame
]
#include
<math.h>
double
fabs
(
double
x
)
{
double
t
;
__asm__
(
"pcmpeqd %0, %0"
:
"=x"
(
t
));
// t = ~0
__asm__
(
"psrlq $1, %0"
:
"+x"
(
t
));
// t >>= 1
__asm__
(
"andps %1, %0"
:
"+x"
(
x
)
:
"x"
(
t
));
// x &= t
return
x
;
}