Skip to content

Commit 8cdf912

Browse files
LIU Zhiweistsquad
authored andcommitted
fpu/softfloat: fix up float16 nan recognition
Signed-off-by: LIU Zhiwei <[email protected]> Signed-off-by: Alex Bennée <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Message-Id: <[email protected]> Message-Id: <[email protected]>
1 parent 6f60a24 commit 8cdf912

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fpu/softfloat-specialize.inc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ bool float16_is_quiet_nan(float16 a_, float_status *status)
254254
if (snan_bit_is_one(status)) {
255255
return (((a >> 9) & 0x3F) == 0x3E) && (a & 0x1FF);
256256
} else {
257-
return ((a & ~0x8000) >= 0x7C80);
257+
return ((a >> 9) & 0x3F) == 0x3F;
258258
}
259259
#endif
260260
}
@@ -271,7 +271,7 @@ bool float16_is_signaling_nan(float16 a_, float_status *status)
271271
#else
272272
uint16_t a = float16_val(a_);
273273
if (snan_bit_is_one(status)) {
274-
return ((a & ~0x8000) >= 0x7C80);
274+
return ((a >> 9) & 0x3F) == 0x3F;
275275
} else {
276276
return (((a >> 9) & 0x3F) == 0x3E) && (a & 0x1FF);
277277
}

0 commit comments

Comments
 (0)