[flang] Use std::clamp (NFC)

The use of std::clamp here is safe because the definition of
largestLDKind gurantees that 8 <= largestLDKind.
This commit is contained in:
Kazu Hirata 2022-08-27 23:54:27 -07:00
parent f119a2483d
commit 6ba2c28dee
1 changed files with 2 additions and 2 deletions

View File

@ -629,8 +629,8 @@ public:
8 8
#endif #endif
}; };
using AccumType = CppTypeFor<TypeCategory::Real, using AccumType =
std::max(std::min(largestLDKind, KIND), 8)>; CppTypeFor<TypeCategory::Real, std::clamp(KIND, 8, largestLDKind)>;
explicit Norm2Accumulator(const Descriptor &array) : array_{array} {} explicit Norm2Accumulator(const Descriptor &array) : array_{array} {}
void Reinitialize() { max_ = sum_ = 0; } void Reinitialize() { max_ = sum_ = 0; }
template <typename A> void GetResult(A *p, int /*zeroBasedDim*/ = -1) const { template <typename A> void GetResult(A *p, int /*zeroBasedDim*/ = -1) const {