[flang-commits] [flang] 49bbb8b - Remove unneeded RoundDefault enumerator, and fix spelling in comments

peter klausler via flang-commits flang-commits at lists.llvm.org
Mon Aug 3 16:15:02 PDT 2020


Author: peter klausler
Date: 2020-08-03T16:14:24-07:00
New Revision: 49bbb8b60e451d173c7dd42993592e8aa4d95f24

URL: https://github.com/llvm/llvm-project/commit/49bbb8b60e451d173c7dd42993592e8aa4d95f24
DIFF: https://github.com/llvm/llvm-project/commit/49bbb8b60e451d173c7dd42993592e8aa4d95f24.diff

LOG: Remove unneeded RoundDefault enumerator, and fix spelling in comments

Added: 
    

Modified: 
    flang/include/flang/Decimal/decimal.h
    flang/lib/Decimal/big-radix-floating-point.h
    flang/lib/Decimal/binary-to-decimal.cpp
    flang/lib/Decimal/decimal-to-binary.cpp
    flang/lib/Evaluate/host.h

Removed: 
    


################################################################################
diff  --git a/flang/include/flang/Decimal/decimal.h b/flang/include/flang/Decimal/decimal.h
index fa687e92d35b..214b1d15d44b 100644
--- a/flang/include/flang/Decimal/decimal.h
+++ b/flang/include/flang/Decimal/decimal.h
@@ -44,12 +44,11 @@ struct ConversionToDecimalResult {
 };
 
 enum FortranRounding {
-  RoundNearest, /* RN */
+  RoundNearest, /* RN and RP */
   RoundUp, /* RU */
   RoundDown, /* RD */
   RoundToZero, /* RZ - no rounding */
   RoundCompatible, /* RC: like RN, but ties go away from 0 */
-  RoundDefault, /* RP: maps to one of the above */
 };
 
 /* The "minimize" flag causes the fewest number of output digits

diff  --git a/flang/lib/Decimal/big-radix-floating-point.h b/flang/lib/Decimal/big-radix-floating-point.h
index 2fbb777104d6..b0ee69ad5e42 100644
--- a/flang/lib/Decimal/big-radix-floating-point.h
+++ b/flang/lib/Decimal/big-radix-floating-point.h
@@ -66,12 +66,12 @@ template <int PREC, int LOG10RADIX = 16> class BigRadixFloatingPointNumber {
 
 public:
   explicit BigRadixFloatingPointNumber(
-      enum FortranRounding rounding = RoundDefault)
+      enum FortranRounding rounding = RoundNearest)
       : rounding_{rounding} {}
 
   // Converts a binary floating point value.
   explicit BigRadixFloatingPointNumber(
-      Real, enum FortranRounding = RoundDefault);
+      Real, enum FortranRounding = RoundNearest);
 
   BigRadixFloatingPointNumber &SetToZero() {
     isNegative_ = false;
@@ -355,7 +355,7 @@ template <int PREC, int LOG10RADIX = 16> class BigRadixFloatingPointNumber {
   int digitLimit_{maxDigits}; // precision clamp
   int exponent_{0}; // signed power of ten
   bool isNegative_{false};
-  enum FortranRounding rounding_ { RoundDefault };
+  enum FortranRounding rounding_ { RoundNearest };
 };
 } // namespace Fortran::decimal
 #endif

diff  --git a/flang/lib/Decimal/binary-to-decimal.cpp b/flang/lib/Decimal/binary-to-decimal.cpp
index bcc0f08558aa..c89bffc8ccd4 100644
--- a/flang/lib/Decimal/binary-to-decimal.cpp
+++ b/flang/lib/Decimal/binary-to-decimal.cpp
@@ -143,7 +143,6 @@ BigRadixFloatingPointNumber<PREC, LOG10RADIX>::ConvertToDecimal(char *buffer,
     bool incr{false};
     switch (rounding_) {
     case RoundNearest:
-    case RoundDefault:
       incr = *end > '5' ||
           (*end == '5' && (p > end + 1 || ((end[-1] - '0') & 1) != 0));
       break;

diff  --git a/flang/lib/Decimal/decimal-to-binary.cpp b/flang/lib/Decimal/decimal-to-binary.cpp
index 502f0a003d64..5e927e93b3bb 100644
--- a/flang/lib/Decimal/decimal-to-binary.cpp
+++ b/flang/lib/Decimal/decimal-to-binary.cpp
@@ -150,7 +150,6 @@ void BigRadixFloatingPointNumber<PREC,
   bool incr{false};
   switch (rounding_) {
   case RoundNearest:
-  case RoundDefault:
     incr = LSD > radix / 2 || (LSD == radix / 2 && digit_[0] % 2 != 0);
     break;
   case RoundUp:
@@ -260,7 +259,6 @@ ConversionToBinaryResult<PREC> IntermediateFloat<PREC>::ToBinary(
   bool incr{false};
   switch (rounding) {
   case RoundNearest:
-  case RoundDefault:
     incr = guard > oneHalf || (guard == oneHalf && (fraction & 1));
     break;
   case RoundUp:

diff  --git a/flang/lib/Evaluate/host.h b/flang/lib/Evaluate/host.h
index 2fac0424f17c..1fc2423f4f0c 100644
--- a/flang/lib/Evaluate/host.h
+++ b/flang/lib/Evaluate/host.h
@@ -140,14 +140,14 @@ template <> struct HostTypeHelper<Type<TypeCategory::Integer, 16>> {
 // It should be defined when gcc/clang have a better support for it.
 
 template <> struct HostTypeHelper<Type<TypeCategory::Real, 4>> {
-  // IEE 754 64bits
+  // IEEE 754 64bits
   using Type = std::conditional_t<sizeof(float) == 4 &&
           std::numeric_limits<float>::is_iec559,
       float, UnsupportedType>;
 };
 
 template <> struct HostTypeHelper<Type<TypeCategory::Real, 8>> {
-  // IEE 754 64bits
+  // IEEE 754 64bits
   using Type = std::conditional_t<sizeof(double) == 8 &&
           std::numeric_limits<double>::is_iec559,
       double, UnsupportedType>;
@@ -162,7 +162,7 @@ template <> struct HostTypeHelper<Type<TypeCategory::Real, 10>> {
 };
 
 template <> struct HostTypeHelper<Type<TypeCategory::Real, 16>> {
-  // IEE 754 128bits
+  // IEEE 754 128bits
   using Type = std::conditional_t<sizeof(long double) == 16 &&
           std::numeric_limits<long double>::digits == 113 &&
           std::numeric_limits<long double>::max_exponent == 16384,


        


More information about the flang-commits mailing list