Re: [Qemu-devel] [PATCH v1] softfloat: add float128_is_{normal, denormal}

2019-02-06 Thread David Hildenbrand
On 06.02.19 04:08, Richard Henderson wrote: > On 2/5/19 4:22 PM, David Hildenbrand wrote: >> +static inline bool float128_is_normal(float128 a) >> +{ >> +return ((a.high + (1ULL << 47)) & -1ULL >> 1) >= 1ULL << 48; > > I believe this is off by one: 1 << 48 and >= 1 << 49. > > The exponent is

Re: [Qemu-devel] [PATCH v1] softfloat: add float128_is_{normal, denormal}

2019-02-05 Thread Richard Henderson
On 2/5/19 4:22 PM, David Hildenbrand wrote: > +static inline bool float128_is_normal(float128 a) > +{ > +return ((a.high + (1ULL << 47)) & -1ULL >> 1) >= 1ULL << 48; I believe this is off by one: 1 << 48 and >= 1 << 49. The exponent is at [62:48]. The trick is adding 1, letting Inf+NaN overf

[Qemu-devel] [PATCH v1] softfloat: add float128_is_{normal, denormal}

2019-02-05 Thread David Hildenbrand
Needed on s390x, to test for the data class of a number. So it will gain soon a user. Signed-off-by: David Hildenbrand --- include/fpu/softfloat.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index 38a5e99cf3..10c31557b4 100644