mfbt/decimal/mfbt-abi-markers.patch

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     1 diff --git a/mfbt/decimal/Decimal.h b/mfbt/decimal/Decimal.h
     2 --- a/mfbt/decimal/Decimal.h
     3 +++ b/mfbt/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   */
    10  #ifndef Decimal_h
    11  #define Decimal_h
    13 +#include "mozilla/Types.h"
    14 +
    15  #include <stdint.h>
    16  #include <wtf/Assertions.h>
    17  #include <wtf/text/WTFString.h>
    19  namespace WebCore {
    21  namespace DecimalPrivate {
    22  class SpecialValueHandler;
    23 @@ -88,92 +90,92 @@ public:
    24          FormatClass formatClass() const { return m_formatClass; }
    26          uint64_t m_coefficient;
    27          int16_t m_exponent;
    28          FormatClass m_formatClass;
    29          Sign m_sign;
    30      };
    32 -    Decimal(int32_t = 0);
    33 -    Decimal(Sign, int exponent, uint64_t coefficient);
    34 -    Decimal(const Decimal&);
    35 +    MFBT_API Decimal(int32_t = 0);
    36 +    MFBT_API Decimal(Sign, int exponent, uint64_t coefficient);
    37 +    MFBT_API Decimal(const Decimal&);
    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&);
    50 -    Decimal operator-() const;
    51 +    MFBT_API Decimal operator-() const;
    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;
    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;
    75      int exponent() const
    76      {
    77          ASSERT(isFinite());
    78          return m_data.exponent();
    79      }
    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(); }
    89 -    Decimal abs() const;
    90 -    Decimal ceiling() 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 ceiling() const;
    96 +    MFBT_API Decimal floor() const;
    97 +    MFBT_API Decimal remainder(const Decimal&) const;
    98 +    MFBT_API Decimal round() const;
   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;
   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);
   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; }
   129  private:
   130      struct AlignedOperands {
   131          uint64_t lhsCoefficient;
   132          uint64_t rhsCoefficient;
   133          int exponent;
   134      };
   136 -    Decimal(double);
   137 -    Decimal compareTo(const Decimal&) const;
   138 +    MFBT_API Decimal(double);
   139 +    MFBT_API Decimal compareTo(const Decimal&) const;
   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; }
   145      Sign sign() const { return m_data.sign(); }
   147      EncodedData m_data;
   148  };
   150  } // namespace WebCore

mercurial