repo.or.cz
/
musl.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
bits/syscall.h: add landlock syscalls from linux v5.13
[musl.git]
/
src
/
math
/
truncf.c
blob
1a7d03c3bce103bffad9a74d701ebc9beb9bad17
1
#include
"libm.h"
2
3
float
truncf
(
float
x
)
4
{
5
union
{
float
f
;
uint32_t
i
;}
u
= {
x
};
6
int
e
= (
int
)(
u
.
i
>>
23
&
0xff
) -
0x7f
+
9
;
7
uint32_t
m
;
8
9
if
(
e
>=
23
+
9
)
10
return
x
;
11
if
(
e
<
9
)
12
e
=
1
;
13
m
= -
1U
>>
e
;
14
if
((
u
.
i
&
m
) ==
0
)
15
return
x
;
16
FORCE_EVAL
(
x
+
0x1
p
120
f
);
17
u
.
i
&= ~
m
;
18
return
u
.
f
;
19
}