diff options
author | Alex Bennée <alex.bennee@linaro.org> | 2017-12-08 17:03:13 +0000 |
---|---|---|
committer | Alex Bennée <alex.bennee@linaro.org> | 2018-02-21 10:20:30 +0000 |
commit | 78b5a3e653c90b56ba650f54c07fc18f7b7bd905 (patch) | |
tree | cdd418daddb9bf492db802e99fd196075c6bfe26 | |
parent | 5f10aef521427b3909c24a0c7a82839b43f876e2 (diff) |
include/fpu/softfloat: implement float16_set_sign helper
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r-- | include/fpu/softfloat.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index f75aa59100..59c06ef192 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -281,6 +281,11 @@ static inline float16 float16_chs(float16 a) return make_float16(float16_val(a) ^ 0x8000); } +static inline float16 float16_set_sign(float16 a, int sign) +{ + return make_float16((float16_val(a) & 0x7fff) | (sign << 15)); +} + /*---------------------------------------------------------------------------- | The pattern for a default generated half-precision NaN. *----------------------------------------------------------------------------*/ |