osdep: protect qemu/osdep.h with extern "C"
[qemu/ar7.git] / tests / tcg / multiarch / float_helpers.h
blob309f3f4bf10d32e4370218be3cb139172e429578
1 /*
2 * Common Float Helpers
4 * Copyright (c) 2019 Linaro
6 * SPDX-License-Identifier: GPL-3.0-or-later
7 */
9 #include <inttypes.h>
11 /* Some hosts do not have support for all of these; not required by ISO C. */
12 #ifndef FE_OVERFLOW
13 #define FE_OVERFLOW 0
14 #endif
15 #ifndef FE_UNDERFLOW
16 #define FE_UNDERFLOW 0
17 #endif
18 #ifndef FE_DIVBYZERO
19 #define FE_DIVBYZERO 0
20 #endif
21 #ifndef FE_INEXACT
22 #define FE_INEXACT 0
23 #endif
24 #ifndef FE_INVALID
25 #define FE_INVALID 0
26 #endif
28 /* Number of constants in each table */
29 int get_num_f16(void);
30 int get_num_f32(void);
31 int get_num_f64(void);
33 /* Accessor helpers, overflows will automatically wrap */
34 uint16_t get_f16(int i); /* use _Float16 when we can */
35 float get_f32(int i);
36 double get_f64(int i);
38 /* Return format strings, free after use */
39 char * fmt_f16(uint16_t);
40 char * fmt_f32(float);
41 char * fmt_f64(double);
42 /* exception flags */
43 char * fmt_flags(void);