]> git.sesse.net Git - movit/blob - fp16.h
Move private libs into Libs.private in the pkg-config file.
[movit] / fp16.h
1 #ifndef _MOVIT_FP16_H
2 #define _MOVIT_FP16_H 1
3
4 // Code for converting to and from fp16 (from fp64), without any particular
5 // machine support, with proper IEEE round-to-even behavior (and correct
6 // handling of NaNs and infinities). This is needed because some OpenGL
7 // drivers don't properly round off when asked to convert data themselves.
8 //
9 // These routines are not particularly fast.
10
11 namespace movit {
12
13 typedef unsigned int fp32_int_t;
14 typedef unsigned short fp16_int_t;
15
16 double fp16_to_fp64(fp16_int_t x);
17 fp16_int_t fp64_to_fp16(double x);
18
19 // These are not very useful by themselves, but are implemented using the same
20 // code as the fp16 ones (just with different constants), so they are useful
21 // for verifying against the FPU in unit tests.
22 double fp32_to_fp64(fp32_int_t x);
23 fp32_int_t fp64_to_fp32(double x);
24
25 }  // namespace movit
26
27 #endif  // _MOVIT_FP16_H