blob: 5af9518eee3c28b77dde967d4f120caa66cd2fe3 [file] [log] [blame]
Jens Axboe90f326d2011-10-05 08:43:47 +02001#ifndef FIO_IEEE754_H
2#define FIO_IEEE754_H
3
Jens Axboe802ad4a2011-10-05 09:51:58 +02004#include <inttypes.h>
5
Jens Axboe90f326d2011-10-05 08:43:47 +02006extern uint64_t pack754(long double f, unsigned bits, unsigned expbits);
7extern long double unpack754(uint64_t i, unsigned bits, unsigned expbits);
8
9#define fio_double_to_uint64(val) pack754((val), 64, 11)
10#define fio_uint64_to_double(val) unpack754((val), 64, 11)
11
Jens Axboe802ad4a2011-10-05 09:51:58 +020012typedef struct fio_fp64 {
13 union {
14 uint64_t i;
15 double f;
16 uint8_t filler[16];
17 } u;
18} fio_fp64_t;
19
Jens Axboe90f326d2011-10-05 08:43:47 +020020#endif