diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2022-09-03 10:40:10 +0200 |
---|---|---|
committer | Aldy Hernandez <aldyh@redhat.com> | 2022-09-04 08:09:42 +0200 |
commit | 6832dd39d7b5ede0122a27633ef1859ce3d893a6 (patch) | |
tree | e3d91e6b4a6c4a6f224a45ee9e0d682c82fae5ef /gcc/real.h | |
parent | 83f2f22850a647bcf1e7cd155fb2ed67f23fc4b3 (diff) | |
download | gcc-6832dd39d7b5ede0122a27633ef1859ce3d893a6.zip gcc-6832dd39d7b5ede0122a27633ef1859ce3d893a6.tar.gz gcc-6832dd39d7b5ede0122a27633ef1859ce3d893a6.tar.bz2 |
Add real_isdenormal.
There are 6 idioms of the same check and I'd like to add more.
It seems there are macros as well as functions for things like
REAL_VALUE_ISINF and REAL_VALUE_NEGATIVE. I don't know if there was
historical need for this duplicity, but I think it's cleaner if we
start gravitating towards inline functions only.
gcc/ChangeLog:
* real.cc (encode_ieee_single): Use real_isdenormal.
(encode_ieee_double): Same.
(encode_ieee_extended): Same.
(encode_ieee_quad): Same.
(encode_ieee_half): Same.
(encode_arm_bfloat_half): Same.
* real.h (real_isdenormal): New.
Diffstat (limited to 'gcc/real.h')
-rw-r--r-- | gcc/real.h | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -286,6 +286,13 @@ extern bool real_isnan (const REAL_VALUE_TYPE *); /* Determine whether a floating-point value X is a signaling NaN. */ extern bool real_issignaling_nan (const REAL_VALUE_TYPE *); +/* Determine whether a floating-point value X is a denormal. */ +inline bool +real_isdenormal (const REAL_VALUE_TYPE *r) +{ + return (r->sig[SIGSZ-1] & SIG_MSB) == 0; +} + /* Determine whether a floating-point value X is finite. */ extern bool real_isfinite (const REAL_VALUE_TYPE *); |