repo.or.cz
/
factor
/
jcg.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Fix POST with streams to use chunked encoding, add http-put word
[factor/jcg.git]
/
vm
/
float_bits.h
blob
a60d42f97c5da5954cdd3c90cef4fec0601fe755
1
/* Some functions for converting floating point numbers to binary
2
representations and vice versa */
3
4
typedef
union
{
5
double
x
;
6
u64 y
;
7
}
F_DOUBLE_BITS
;
8
9
INLINE u64
double_bits
(
double
x
)
10
{
11
F_DOUBLE_BITS b
;
12
b
.
x
=
x
;
13
return
b
.
y
;
14
}
15
16
INLINE
double
bits_double
(
u64 y
)
17
{
18
F_DOUBLE_BITS b
;
19
b
.
y
=
y
;
20
return
b
.
x
;
21
}
22
23
typedef
union
{
24
float
x
;
25
u32 y
;
26
}
F_FLOAT_BITS
;
27
28
INLINE u32
float_bits
(
float
x
)
29
{
30
F_FLOAT_BITS b
;
31
b
.
x
=
x
;
32
return
b
.
y
;
33
}
34
35
INLINE
float
bits_float
(
u32 y
)
36
{
37
F_FLOAT_BITS b
;
38
b
.
y
=
y
;
39
return
b
.
x
;
40
}