aboutsummaryrefslogtreecommitdiff
path: root/fpu/softfloat.h
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2011-02-10 13:59:34 +0000
committerAurelien Jarno <aurelien@aurel32.net>2011-02-10 20:16:43 +0100
commitd5138cf4a8f2415d2d568adfd3f65d3cc5a0b736 (patch)
tree068f66d97323185ac4b9c7bdf00f90f7871401bc /fpu/softfloat.h
parent2d981da77d7fb0c3ec83286bc617c4fc64765ac2 (diff)
softfloat: Fix compilation failures with USE_SOFTFLOAT_STRUCT_TYPES
Make softfloat compile with USE_SOFTFLOAT_STRUCT_TYPES defined, by adding and using new macros const_float16(), const_float32() and const_float64() so you can use array initializers in an array of float16/float32/float64 whether the types are bare or wrapped in the structs. [aurelien@aurel32.net: do the same for float16] Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'fpu/softfloat.h')
-rw-r--r--fpu/softfloat.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/fpu/softfloat.h b/fpu/softfloat.h
index 2296adb4c6..e57ee1efb0 100644
--- a/fpu/softfloat.h
+++ b/fpu/softfloat.h
@@ -124,17 +124,20 @@ typedef struct {
} float16;
#define float16_val(x) (((float16)(x)).v)
#define make_float16(x) __extension__ ({ float16 f16_val = {x}; f16_val; })
+#define const_float16(x) { x }
typedef struct {
uint32_t v;
} float32;
/* The cast ensures an error if the wrong type is passed. */
#define float32_val(x) (((float32)(x)).v)
#define make_float32(x) __extension__ ({ float32 f32_val = {x}; f32_val; })
+#define const_float32(x) { x }
typedef struct {
uint64_t v;
} float64;
#define float64_val(x) (((float64)(x)).v)
#define make_float64(x) __extension__ ({ float64 f64_val = {x}; f64_val; })
+#define const_float64(x) { x }
#else
typedef uint16_t float16;
typedef uint32_t float32;
@@ -145,6 +148,9 @@ typedef uint64_t float64;
#define make_float16(x) (x)
#define make_float32(x) (x)
#define make_float64(x) (x)
+#define const_float16(x) (x)
+#define const_float32(x) (x)
+#define const_float64(x) (x)
#endif
#ifdef FLOATX80
typedef struct {