| 1 |
diff --git a/mozglue/misc/decimal/Decimal.h b/mozglue/misc/decimal/Decimal.h |
| 2 |
--- a/mozglue/misc/decimal/Decimal.h |
| 3 |
+++ b/mozglue/misc/decimal/Decimal.h |
| 4 |
@@ -26,16 +26,18 @@ |
| 5 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 6 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 7 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 8 |
*/ |
| 9 |
|
| 10 |
#ifndef Decimal_h |
| 11 |
#define Decimal_h |
| 12 |
|
| 13 |
+#include "mozilla/Types.h" |
| 14 |
+ |
| 15 |
#include "platform/PlatformExport.h" |
| 16 |
#include "wtf/Allocator.h" |
| 17 |
#include "wtf/Assertions.h" |
| 18 |
#include "wtf/text/WTFString.h" |
| 19 |
#include <stdint.h> |
| 20 |
|
| 21 |
namespace blink { |
| 22 |
|
| 23 |
@@ -91,92 +93,92 @@ public: |
| 24 |
FormatClass formatClass() const { return m_formatClass; } |
| 25 |
|
| 26 |
uint64_t m_coefficient; |
| 27 |
int16_t m_exponent; |
| 28 |
FormatClass m_formatClass; |
| 29 |
Sign m_sign; |
| 30 |
}; |
| 31 |
|
| 32 |
- Decimal(int32_t = 0); |
| 33 |
- Decimal(Sign, int exponent, uint64_t coefficient); |
| 34 |
- Decimal(const Decimal&); |
| 35 |
+ MFBT_API explicit Decimal(int32_t = 0); |
| 36 |
+ MFBT_API Decimal(Sign, int exponent, uint64_t coefficient); |
| 37 |
+ MFBT_API Decimal(const Decimal&); |
| 38 |
|
| 39 |
- Decimal& operator=(const Decimal&); |
| 40 |
- Decimal& operator+=(const Decimal&); |
| 41 |
- Decimal& operator-=(const Decimal&); |
| 42 |
- Decimal& operator*=(const Decimal&); |
| 43 |
- Decimal& operator/=(const Decimal&); |
| 44 |
+ MFBT_API Decimal& operator=(const Decimal&); |
| 45 |
+ MFBT_API Decimal& operator+=(const Decimal&); |
| 46 |
+ MFBT_API Decimal& operator-=(const Decimal&); |
| 47 |
+ MFBT_API Decimal& operator*=(const Decimal&); |
| 48 |
+ MFBT_API Decimal& operator/=(const Decimal&); |
| 49 |
|
| 50 |
- Decimal operator-() const; |
| 51 |
+ MFBT_API Decimal operator-() const; |
| 52 |
|
| 53 |
- bool operator==(const Decimal&) const; |
| 54 |
- bool operator!=(const Decimal&) const; |
| 55 |
- bool operator<(const Decimal&) const; |
| 56 |
- bool operator<=(const Decimal&) const; |
| 57 |
- bool operator>(const Decimal&) const; |
| 58 |
- bool operator>=(const Decimal&) const; |
| 59 |
+ MFBT_API bool operator==(const Decimal&) const; |
| 60 |
+ MFBT_API bool operator!=(const Decimal&) const; |
| 61 |
+ MFBT_API bool operator<(const Decimal&) const; |
| 62 |
+ MFBT_API bool operator<=(const Decimal&) const; |
| 63 |
+ MFBT_API bool operator>(const Decimal&) const; |
| 64 |
+ MFBT_API bool operator>=(const Decimal&) const; |
| 65 |
|
| 66 |
- Decimal operator+(const Decimal&) const; |
| 67 |
- Decimal operator-(const Decimal&) const; |
| 68 |
- Decimal operator*(const Decimal&) const; |
| 69 |
- Decimal operator/(const Decimal&) const; |
| 70 |
+ MFBT_API Decimal operator+(const Decimal&) const; |
| 71 |
+ MFBT_API Decimal operator-(const Decimal&) const; |
| 72 |
+ MFBT_API Decimal operator*(const Decimal&) const; |
| 73 |
+ MFBT_API Decimal operator/(const Decimal&) const; |
| 74 |
|
| 75 |
int exponent() const |
| 76 |
{ |
| 77 |
ASSERT(isFinite()); |
| 78 |
return m_data.exponent(); |
| 79 |
} |
| 80 |
|
| 81 |
bool isFinite() const { return m_data.isFinite(); } |
| 82 |
bool isInfinity() const { return m_data.isInfinity(); } |
| 83 |
bool isNaN() const { return m_data.isNaN(); } |
| 84 |
bool isNegative() const { return sign() == Negative; } |
| 85 |
bool isPositive() const { return sign() == Positive; } |
| 86 |
bool isSpecial() const { return m_data.isSpecial(); } |
| 87 |
bool isZero() const { return m_data.isZero(); } |
| 88 |
|
| 89 |
- Decimal abs() const; |
| 90 |
- Decimal ceil() const; |
| 91 |
- Decimal floor() const; |
| 92 |
- Decimal remainder(const Decimal&) const; |
| 93 |
- Decimal round() const; |
| 94 |
+ MFBT_API Decimal abs() const; |
| 95 |
+ MFBT_API Decimal ceil() const; |
| 96 |
+ MFBT_API Decimal floor() const; |
| 97 |
+ MFBT_API Decimal remainder(const Decimal&) const; |
| 98 |
+ MFBT_API Decimal round() const; |
| 99 |
|
| 100 |
- double toDouble() const; |
| 101 |
+ MFBT_API double toDouble() const; |
| 102 |
// Note: toString method supports infinity and nan but fromString not. |
| 103 |
- String toString() const; |
| 104 |
+ MFBT_API String toString() const; |
| 105 |
|
| 106 |
- static Decimal fromDouble(double); |
| 107 |
+ static MFBT_API Decimal fromDouble(double); |
| 108 |
// fromString supports following syntax EBNF: |
| 109 |
// number ::= sign? digit+ ('.' digit*) (exponent-marker sign? digit+)? |
| 110 |
// | sign? '.' digit+ (exponent-marker sign? digit+)? |
| 111 |
// sign ::= '+' | '-' |
| 112 |
// exponent-marker ::= 'e' | 'E' |
| 113 |
// digit ::= '0' | '1' | ... | '9' |
| 114 |
// Note: fromString doesn't support "infinity" and "nan". |
| 115 |
- static Decimal fromString(const String&); |
| 116 |
- static Decimal infinity(Sign); |
| 117 |
- static Decimal nan(); |
| 118 |
- static Decimal zero(Sign); |
| 119 |
+ static MFBT_API Decimal fromString(const String&); |
| 120 |
+ static MFBT_API Decimal infinity(Sign); |
| 121 |
+ static MFBT_API Decimal nan(); |
| 122 |
+ static MFBT_API Decimal zero(Sign); |
| 123 |
|
| 124 |
// You should not use below methods. We expose them for unit testing. |
| 125 |
- explicit Decimal(const EncodedData&); |
| 126 |
+ MFBT_API explicit Decimal(const EncodedData&); |
| 127 |
const EncodedData& value() const { return m_data; } |
| 128 |
|
| 129 |
private: |
| 130 |
struct AlignedOperands { |
| 131 |
uint64_t lhsCoefficient; |
| 132 |
uint64_t rhsCoefficient; |
| 133 |
int exponent; |
| 134 |
}; |
| 135 |
|
| 136 |
- Decimal(double); |
| 137 |
- Decimal compareTo(const Decimal&) const; |
| 138 |
+ MFBT_API explicit Decimal(double); |
| 139 |
+ MFBT_API Decimal compareTo(const Decimal&) const; |
| 140 |
|
| 141 |
- static AlignedOperands alignOperands(const Decimal& lhs, const Decimal& rhs); |
| 142 |
+ static MFBT_API AlignedOperands alignOperands(const Decimal& lhs, const Decimal& rhs); |
| 143 |
static inline Sign invertSign(Sign sign) { return sign == Negative ? Positive : Negative; } |
| 144 |
|
| 145 |
Sign sign() const { return m_data.sign(); } |
| 146 |
|
| 147 |
EncodedData m_data; |
| 148 |
}; |
| 149 |
|
| 150 |
} // namespace blink |