From 6f3300ad2b5a1e7090720993d9fcb9f550259e12 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Fri, 14 Jan 2011 20:39:18 +0100 Subject: [PATCH] softfloat: Add float32_is_zero_or_denormal() function Add a utility function to softfloat to test whether a float32 is zero or denormal. Signed-off-by: Peter Maydell Reviewed-by: Aurelien Jarno Signed-off-by: Aurelien Jarno --- fpu/softfloat.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fpu/softfloat.h b/fpu/softfloat.h index a6d0f16b4..4a5345cec 100644 --- a/fpu/softfloat.h +++ b/fpu/softfloat.h @@ -336,6 +336,11 @@ INLINE int float32_is_any_nan(float32 a) return ((float32_val(a) & ~(1 << 31)) > 0x7f800000UL); } +INLINE int float32_is_zero_or_denormal(float32 a) +{ + return (float32_val(a) & 0x7f800000) == 0; +} + #define float32_zero make_float32(0) #define float32_one make_float32(0x3f800000) #define float32_ln2 make_float32(0x3f317218) -- 2.39.2