mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-30 10:30:22 +00:00
Refactor static normalize
- Use a single worker function that does all the work and explicit template instantiation. If this gives me any more trouble, I'm just going to move normalize into the header, but I was hoping to avoid that.
This commit is contained in:
@@ -327,6 +327,15 @@ private:
|
||||
internalrep const& minMantissa,
|
||||
internalrep const& maxMantissa);
|
||||
|
||||
template <class T>
|
||||
friend void
|
||||
doNormalize(
|
||||
bool& negative,
|
||||
T& mantissa_,
|
||||
int& exponent_,
|
||||
MantissaRange::rep const& minMantissa,
|
||||
MantissaRange::rep const& maxMantissa);
|
||||
|
||||
bool
|
||||
isnormal() const noexcept;
|
||||
|
||||
@@ -537,17 +546,6 @@ Number::isnormal() const noexcept
|
||||
exponent_ <= maxExponent);
|
||||
}
|
||||
|
||||
// Because the template function definition is in the .cpp file, declare
|
||||
// some of the overrides used outside of this class here.
|
||||
template <>
|
||||
void
|
||||
Number::normalize<unsigned long>(
|
||||
bool& negative,
|
||||
unsigned long& mantissa,
|
||||
int& exponent,
|
||||
internalrep const& minMantissa,
|
||||
internalrep const& maxMantissa);
|
||||
|
||||
template <class T>
|
||||
std::pair<T, int>
|
||||
Number::normalizeToRange(T minMantissa, T maxMantissa) const
|
||||
|
||||
Reference in New Issue
Block a user