| 1 |
diff --git a/mozglue/misc/decimal/Decimal.cpp b/mozglue/misc/decimal/Decimal.cpp |
| 2 |
--- a/mozglue/misc/decimal/Decimal.cpp |
| 3 |
+++ b/mozglue/misc/decimal/Decimal.cpp |
| 4 |
@@ -118,18 +118,18 @@ Decimal SpecialValueHandler::value() con |
| 5 |
ASSERT_NOT_REACHED(); |
| 6 |
return m_lhs; |
| 7 |
} |
| 8 |
} |
| 9 |
|
| 10 |
// This class is used for 128 bit unsigned integer arithmetic. |
| 11 |
class UInt128 { |
| 12 |
public: |
| 13 |
- UInt128(uint64_t low, uint64_t high) |
| 14 |
- : m_high(high), m_low(low) |
| 15 |
+ UInt128(uint64_t aLow, uint64_t aHigh) |
| 16 |
+ : m_high(aHigh), m_low(aLow) |
| 17 |
{ |
| 18 |
} |
| 19 |
|
| 20 |
UInt128& operator/=(uint32_t); |
| 21 |
|
| 22 |
uint64_t high() const { return m_high; } |
| 23 |
uint64_t low() const { return m_low; } |
| 24 |
|
| 25 |
@@ -224,68 +224,68 @@ static uint64_t scaleUp(uint64_t x, int |
| 26 |
z = z * z; |
| 27 |
} |
| 28 |
} |
| 29 |
|
| 30 |
} // namespace DecimalPrivate |
| 31 |
|
| 32 |
using namespace DecimalPrivate; |
| 33 |
|
| 34 |
-Decimal::EncodedData::EncodedData(Sign sign, FormatClass formatClass) |
| 35 |
+Decimal::EncodedData::EncodedData(Sign aSign, FormatClass aFormatClass) |
| 36 |
: m_coefficient(0) |
| 37 |
, m_exponent(0) |
| 38 |
- , m_formatClass(formatClass) |
| 39 |
- , m_sign(sign) |
| 40 |
+ , m_formatClass(aFormatClass) |
| 41 |
+ , m_sign(aSign) |
| 42 |
{ |
| 43 |
} |
| 44 |
|
| 45 |
-Decimal::EncodedData::EncodedData(Sign sign, int exponent, uint64_t coefficient) |
| 46 |
- : m_formatClass(coefficient ? ClassNormal : ClassZero) |
| 47 |
- , m_sign(sign) |
| 48 |
+Decimal::EncodedData::EncodedData(Sign aSign, int aExponent, uint64_t aCoefficient) |
| 49 |
+ : m_formatClass(aCoefficient ? ClassNormal : ClassZero) |
| 50 |
+ , m_sign(aSign) |
| 51 |
{ |
| 52 |
- if (exponent >= ExponentMin && exponent <= ExponentMax) { |
| 53 |
- while (coefficient > MaxCoefficient) { |
| 54 |
- coefficient /= 10; |
| 55 |
- ++exponent; |
| 56 |
+ if (aExponent >= ExponentMin && aExponent <= ExponentMax) { |
| 57 |
+ while (aCoefficient > MaxCoefficient) { |
| 58 |
+ aCoefficient /= 10; |
| 59 |
+ ++aExponent; |
| 60 |
} |
| 61 |
} |
| 62 |
|
| 63 |
- if (exponent > ExponentMax) { |
| 64 |
+ if (aExponent > ExponentMax) { |
| 65 |
m_coefficient = 0; |
| 66 |
m_exponent = 0; |
| 67 |
m_formatClass = ClassInfinity; |
| 68 |
return; |
| 69 |
} |
| 70 |
|
| 71 |
- if (exponent < ExponentMin) { |
| 72 |
+ if (aExponent < ExponentMin) { |
| 73 |
m_coefficient = 0; |
| 74 |
m_exponent = 0; |
| 75 |
m_formatClass = ClassZero; |
| 76 |
return; |
| 77 |
} |
| 78 |
|
| 79 |
- m_coefficient = coefficient; |
| 80 |
- m_exponent = static_cast<int16_t>(exponent); |
| 81 |
+ m_coefficient = aCoefficient; |
| 82 |
+ m_exponent = static_cast<int16_t>(aExponent); |
| 83 |
} |
| 84 |
|
| 85 |
bool Decimal::EncodedData::operator==(const EncodedData& another) const |
| 86 |
{ |
| 87 |
return m_sign == another.m_sign |
| 88 |
&& m_formatClass == another.m_formatClass |
| 89 |
&& m_exponent == another.m_exponent |
| 90 |
&& m_coefficient == another.m_coefficient; |
| 91 |
} |
| 92 |
|
| 93 |
Decimal::Decimal(int32_t i32) |
| 94 |
: m_data(i32 < 0 ? Negative : Positive, 0, i32 < 0 ? static_cast<uint64_t>(-static_cast<int64_t>(i32)) : static_cast<uint64_t>(i32)) |
| 95 |
{ |
| 96 |
} |
| 97 |
|
| 98 |
-Decimal::Decimal(Sign sign, int exponent, uint64_t coefficient) |
| 99 |
- : m_data(sign, coefficient ? exponent : 0, coefficient) |
| 100 |
+Decimal::Decimal(Sign aSign, int aExponent, uint64_t aCoefficient) |
| 101 |
+ : m_data(aSign, aCoefficient ? aExponent : 0, aCoefficient) |
| 102 |
{ |
| 103 |
} |
| 104 |
|
| 105 |
Decimal::Decimal(const EncodedData& data) |
| 106 |
: m_data(data) |
| 107 |
{ |
| 108 |
} |
| 109 |
|
| 110 |
@@ -479,32 +479,32 @@ Decimal Decimal::operator/(const Decimal |
| 111 |
if (rhs.isZero()) |
| 112 |
return lhs.isZero() ? nan() : infinity(resultSign); |
| 113 |
|
| 114 |
int resultExponent = lhs.exponent() - rhs.exponent(); |
| 115 |
|
| 116 |
if (lhs.isZero()) |
| 117 |
return Decimal(resultSign, resultExponent, 0); |
| 118 |
|
| 119 |
- uint64_t remainder = lhs.m_data.coefficient(); |
| 120 |
+ uint64_t lhsRemainder = lhs.m_data.coefficient(); |
| 121 |
const uint64_t divisor = rhs.m_data.coefficient(); |
| 122 |
uint64_t result = 0; |
| 123 |
while (result < MaxCoefficient / 100) { |
| 124 |
- while (remainder < divisor) { |
| 125 |
- remainder *= 10; |
| 126 |
+ while (lhsRemainder < divisor) { |
| 127 |
+ lhsRemainder *= 10; |
| 128 |
result *= 10; |
| 129 |
--resultExponent; |
| 130 |
} |
| 131 |
- result += remainder / divisor; |
| 132 |
- remainder %= divisor; |
| 133 |
- if (!remainder) |
| 134 |
+ result += lhsRemainder / divisor; |
| 135 |
+ lhsRemainder %= divisor; |
| 136 |
+ if (!lhsRemainder) |
| 137 |
break; |
| 138 |
} |
| 139 |
|
| 140 |
- if (remainder > divisor / 2) |
| 141 |
+ if (lhsRemainder > divisor / 2) |
| 142 |
++result; |
| 143 |
|
| 144 |
return Decimal(resultSign, resultExponent, result); |
| 145 |
} |
| 146 |
|
| 147 |
bool Decimal::operator==(const Decimal& rhs) const |
| 148 |
{ |
| 149 |
if (isNaN() || rhs.isNaN()) |
| 150 |
diff --git a/mozglue/misc/decimal/Decimal.h b/mozglue/misc/decimal/Decimal.h |
| 151 |
--- a/mozglue/misc/decimal/Decimal.h |
| 152 |
+++ b/mozglue/misc/decimal/Decimal.h |
| 153 |
@@ -88,17 +88,17 @@ public: |
| 154 |
int countDigits() const; |
| 155 |
int exponent() const { return m_exponent; } |
| 156 |
bool isFinite() const { return !isSpecial(); } |
| 157 |
bool isInfinity() const { return m_formatClass == ClassInfinity; } |
| 158 |
bool isNaN() const { return m_formatClass == ClassNaN; } |
| 159 |
bool isSpecial() const { return m_formatClass == ClassInfinity || m_formatClass == ClassNaN; } |
| 160 |
bool isZero() const { return m_formatClass == ClassZero; } |
| 161 |
Sign sign() const { return m_sign; } |
| 162 |
- void setSign(Sign sign) { m_sign = sign; } |
| 163 |
+ void setSign(Sign aSign) { m_sign = aSign; } |
| 164 |
|
| 165 |
private: |
| 166 |
enum FormatClass { |
| 167 |
ClassInfinity, |
| 168 |
ClassNormal, |
| 169 |
ClassNaN, |
| 170 |
ClassZero, |
| 171 |
}; |