Sign in
cobalt
/
cobalt
/
25902c6cb1ab9cfd8ae2ee6b0fb52953f73deda5
/
.
/
third_party
/
musl
/
src
/
math
/
x86_64
/
fabsf.c
blob: 36ea7481fc402a55075c59b9cbac36b6714712da [
file
] [
log
] [
blame
]
#include
<math.h>
float
fabsf
(
float
x
)
{
float
t
;
__asm__
(
"pcmpeqd %0, %0"
:
"=x"
(
t
));
// t = ~0
__asm__
(
"psrld $1, %0"
:
"+x"
(
t
));
// t >>= 1
__asm__
(
"andps %1, %0"
:
"+x"
(
x
)
:
"x"
(
t
));
// x &= t
return
x
;
}