Home | History | Annotate | Download | only in lib
      1 #ifndef FIO_IEEE754_H
      2 #define FIO_IEEE754_H
      3 
      4 #include <inttypes.h>
      5 
      6 extern uint64_t pack754(long double f, unsigned bits, unsigned expbits);
      7 extern 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 
     12 typedef struct fio_fp64 {
     13 	union {
     14 		uint64_t i;
     15 		double f;
     16 		uint8_t filler[16];
     17 	} u;
     18 } fio_fp64_t;
     19 
     20 #endif
     21