Skip to content

Commit 49bbb8b

Browse files
committed
Remove unneeded RoundDefault enumerator, and fix spelling in comments
1 parent 7c5630f commit 49bbb8b

File tree

5 files changed

+7
-11
lines changed

5 files changed

+7
-11
lines changed

flang/include/flang/Decimal/decimal.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,11 @@ struct ConversionToDecimalResult {
4444
};
4545

4646
enum FortranRounding {
47-
RoundNearest, /* RN */
47+
RoundNearest, /* RN and RP */
4848
RoundUp, /* RU */
4949
RoundDown, /* RD */
5050
RoundToZero, /* RZ - no rounding */
5151
RoundCompatible, /* RC: like RN, but ties go away from 0 */
52-
RoundDefault, /* RP: maps to one of the above */
5352
};
5453

5554
/* The "minimize" flag causes the fewest number of output digits

flang/lib/Decimal/big-radix-floating-point.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ template <int PREC, int LOG10RADIX = 16> class BigRadixFloatingPointNumber {
6666

6767
public:
6868
explicit BigRadixFloatingPointNumber(
69-
enum FortranRounding rounding = RoundDefault)
69+
enum FortranRounding rounding = RoundNearest)
7070
: rounding_{rounding} {}
7171

7272
// Converts a binary floating point value.
7373
explicit BigRadixFloatingPointNumber(
74-
Real, enum FortranRounding = RoundDefault);
74+
Real, enum FortranRounding = RoundNearest);
7575

7676
BigRadixFloatingPointNumber &SetToZero() {
7777
isNegative_ = false;
@@ -355,7 +355,7 @@ template <int PREC, int LOG10RADIX = 16> class BigRadixFloatingPointNumber {
355355
int digitLimit_{maxDigits}; // precision clamp
356356
int exponent_{0}; // signed power of ten
357357
bool isNegative_{false};
358-
enum FortranRounding rounding_ { RoundDefault };
358+
enum FortranRounding rounding_ { RoundNearest };
359359
};
360360
} // namespace Fortran::decimal
361361
#endif

flang/lib/Decimal/binary-to-decimal.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ BigRadixFloatingPointNumber<PREC, LOG10RADIX>::ConvertToDecimal(char *buffer,
143143
bool incr{false};
144144
switch (rounding_) {
145145
case RoundNearest:
146-
case RoundDefault:
147146
incr = *end > '5' ||
148147
(*end == '5' && (p > end + 1 || ((end[-1] - '0') & 1) != 0));
149148
break;

flang/lib/Decimal/decimal-to-binary.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ void BigRadixFloatingPointNumber<PREC,
150150
bool incr{false};
151151
switch (rounding_) {
152152
case RoundNearest:
153-
case RoundDefault:
154153
incr = LSD > radix / 2 || (LSD == radix / 2 && digit_[0] % 2 != 0);
155154
break;
156155
case RoundUp:
@@ -260,7 +259,6 @@ ConversionToBinaryResult<PREC> IntermediateFloat<PREC>::ToBinary(
260259
bool incr{false};
261260
switch (rounding) {
262261
case RoundNearest:
263-
case RoundDefault:
264262
incr = guard > oneHalf || (guard == oneHalf && (fraction & 1));
265263
break;
266264
case RoundUp:

flang/lib/Evaluate/host.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,14 @@ template <> struct HostTypeHelper<Type<TypeCategory::Integer, 16>> {
140140
// It should be defined when gcc/clang have a better support for it.
141141

142142
template <> struct HostTypeHelper<Type<TypeCategory::Real, 4>> {
143-
// IEE 754 64bits
143+
// IEEE 754 64bits
144144
using Type = std::conditional_t<sizeof(float) == 4 &&
145145
std::numeric_limits<float>::is_iec559,
146146
float, UnsupportedType>;
147147
};
148148

149149
template <> struct HostTypeHelper<Type<TypeCategory::Real, 8>> {
150-
// IEE 754 64bits
150+
// IEEE 754 64bits
151151
using Type = std::conditional_t<sizeof(double) == 8 &&
152152
std::numeric_limits<double>::is_iec559,
153153
double, UnsupportedType>;
@@ -162,7 +162,7 @@ template <> struct HostTypeHelper<Type<TypeCategory::Real, 10>> {
162162
};
163163

164164
template <> struct HostTypeHelper<Type<TypeCategory::Real, 16>> {
165-
// IEE 754 128bits
165+
// IEEE 754 128bits
166166
using Type = std::conditional_t<sizeof(long double) == 16 &&
167167
std::numeric_limits<long double>::digits == 113 &&
168168
std::numeric_limits<long double>::max_exponent == 16384,

0 commit comments

Comments
 (0)