File: ieee754.h

package info (click to toggle)
fio 3.41-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,012 kB
  • sloc: ansic: 82,290; python: 9,862; sh: 6,067; makefile: 813; yacc: 204; lex: 184
file content (20 lines) | stat: -rw-r--r-- 445 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef FIO_IEEE754_H
#define FIO_IEEE754_H

#include <inttypes.h>

extern uint64_t pack754(long double f, unsigned bits, unsigned expbits);
extern long double unpack754(uint64_t i, unsigned bits, unsigned expbits);

#define fio_double_to_uint64(val)	pack754((val), 64, 11)
#define fio_uint64_to_double(val)	unpack754((val), 64, 11)

typedef struct fio_fp64 {
	union {
		uint64_t i;
		double f;
		uint8_t filler[16];
	} u;
} fio_fp64_t;

#endif