6663b6c9
adorian
projet complet av...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#include <private/ieee754.h>
uint32_t ieee754man32(float x) {
union {
float f;
uint32_t i;
} u;
u.f = x;
return (u.i & ((1<<23)-1));
}
uint8_t ieee754exp32(float x) {
union {
float f;
uint32_t i;
} u;
u.f = x;
return (u.i >> 23) & 0xFF;
}
uint64_t ieee754man64(double x) {
union {
double d;
uint64_t i;
} u;
u.d = x;
return (u.i & (((uint64_t)1<<52)-1));
}
uint16_t ieee754exp64(double x) {
union {
double d;
uint64_t i;
} u;
u.d = x;
return (uint16_t)((u.i >> 52) & 0x7FF);
}
|