@@ -386,8 +386,11 @@ struct FPRepBase : public internal::FPLayout<fp_type> {
386
386
bits = (value & FP_MASK);
387
387
}
388
388
389
- LIBC_INLINE constexpr bool is_zero () const {
390
- return (bits & EXP_SIG_MASK) == 0 ;
389
+ LIBC_INLINE constexpr bool is_zero () const { return exp_sig_bits () == 0 ; }
390
+
391
+ LIBC_INLINE
392
+ constexpr bool is_subnormal () const {
393
+ return exp_bits () == encode (BiasedExponent::BITS_ALL_ZEROES ());
391
394
}
392
395
393
396
LIBC_INLINE constexpr bool is_neg () const { return sign ().is_neg (); }
@@ -435,19 +438,11 @@ template <FPType fp_type> struct FPRep : public FPRepBase<fp_type> {
435
438
return exp_sig_bits () ==
436
439
encode (BiasedExponent::BITS_ALL_ONES (), Significand::ZERO ());
437
440
}
438
- LIBC_INLINE constexpr bool is_zero () const {
439
- return exp_sig_bits () ==
440
- encode (BiasedExponent::BITS_ALL_ZEROES (), Significand::ZERO ());
441
- }
442
441
LIBC_INLINE constexpr bool is_finite () const {
443
442
return exp_bits () != encode (BiasedExponent::BITS_ALL_ONES ());
444
443
}
445
- LIBC_INLINE
446
- constexpr bool is_subnormal () const {
447
- return exp_bits () == encode (BiasedExponent::BITS_ALL_ZEROES ());
448
- }
449
444
LIBC_INLINE constexpr bool is_normal () const {
450
- return is_finite () && !is_subnormal ();
445
+ return is_finite () && !UP:: is_subnormal ();
451
446
}
452
447
453
448
LIBC_INLINE static constexpr StorageType zero (Sign sign = Sign::POS) {
@@ -488,7 +483,7 @@ template <FPType fp_type> struct FPRep : public FPRepBase<fp_type> {
488
483
// The function return mantissa with the implicit bit set iff the current
489
484
// value is a valid normal number.
490
485
LIBC_INLINE constexpr StorageType get_explicit_mantissa () {
491
- if (is_subnormal ())
486
+ if (UP:: is_subnormal ())
492
487
return sig_bits ();
493
488
return (StorageType (1 ) << UP::SIG_LEN) | sig_bits ();
494
489
}
@@ -550,18 +545,9 @@ struct FPRep<FPType::X86_Binary80> : public FPRepBase<FPType::X86_Binary80> {
550
545
return exp_sig_bits () ==
551
546
encode (BiasedExponent::BITS_ALL_ONES (), Significand::MSB ());
552
547
}
553
- LIBC_INLINE constexpr bool is_zero () const {
554
- return exp_sig_bits () ==
555
- encode (BiasedExponent::BITS_ALL_ZEROES (), Significand::ZERO ());
556
- }
557
548
LIBC_INLINE constexpr bool is_finite () const {
558
549
return !is_inf () && !is_nan ();
559
550
}
560
- LIBC_INLINE
561
- constexpr bool is_subnormal () const {
562
- return exp_sig_bits () >
563
- encode (BiasedExponent::BITS_ALL_ZEROES (), Significand::ZERO ());
564
- }
565
551
LIBC_INLINE constexpr bool is_normal () const {
566
552
const auto exp = exp_bits ();
567
553
if (exp == encode (BiasedExponent::BITS_ALL_ZEROES ()) ||
0 commit comments