OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 UInt128& operator/=(uint32_t); | 133 UInt128& operator/=(uint32_t); |
134 | 134 |
135 uint64_t high() const { return m_high; } | 135 uint64_t high() const { return m_high; } |
136 uint64_t low() const { return m_low; } | 136 uint64_t low() const { return m_low; } |
137 | 137 |
138 static UInt128 multiply(uint64_t u, uint64_t v) { return UInt128(u * v, mult
iplyHigh(u, v)); } | 138 static UInt128 multiply(uint64_t u, uint64_t v) { return UInt128(u * v, mult
iplyHigh(u, v)); } |
139 | 139 |
140 private: | 140 private: |
141 static uint32_t highUInt32(uint64_t x) { return static_cast<uint32_t>(x >> 3
2); } | 141 static uint32_t highUInt32(uint64_t x) { return static_cast<uint32_t>(x >> 3
2); } |
142 static uint32_t lowUInt32(uint64_t x) { return static_cast<uint32_t>(x & ((s
tatic_cast<uint64_t>(1) << 32) - 1)); } | 142 static uint32_t lowUInt32(uint64_t x) { return static_cast<uint32_t>(x & ((s
tatic_cast<uint64_t>(1) << 32) - 1)); } |
143 bool isZero() const { return !m_low && !m_high; } | |
144 static uint64_t makeUInt64(uint32_t low, uint32_t high) { return low | (stat
ic_cast<uint64_t>(high) << 32); } | 143 static uint64_t makeUInt64(uint32_t low, uint32_t high) { return low | (stat
ic_cast<uint64_t>(high) << 32); } |
145 | 144 |
146 static uint64_t multiplyHigh(uint64_t, uint64_t); | 145 static uint64_t multiplyHigh(uint64_t, uint64_t); |
147 | 146 |
148 uint64_t m_high; | 147 uint64_t m_high; |
149 uint64_t m_low; | 148 uint64_t m_low; |
150 }; | 149 }; |
151 | 150 |
152 UInt128& UInt128::operator/=(const uint32_t divisor) | 151 UInt128& UInt128::operator/=(const uint32_t divisor) |
153 { | 152 { |
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 } | 1017 } |
1019 return builder.toString(); | 1018 return builder.toString(); |
1020 } | 1019 } |
1021 | 1020 |
1022 Decimal Decimal::zero(Sign sign) | 1021 Decimal Decimal::zero(Sign sign) |
1023 { | 1022 { |
1024 return Decimal(EncodedData(sign, EncodedData::ClassZero)); | 1023 return Decimal(EncodedData(sign, EncodedData::ClassZero)); |
1025 } | 1024 } |
1026 | 1025 |
1027 } // namespace WebCore | 1026 } // namespace WebCore |
OLD | NEW |