| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 void MultiplyByPowerOfTen(int exponent); | 62 void MultiplyByPowerOfTen(int exponent); |
| 63 void Times10() { return MultiplyByUInt32(10); } | 63 void Times10() { return MultiplyByUInt32(10); } |
| 64 // Pseudocode: | 64 // Pseudocode: |
| 65 // int result = this / other; | 65 // int result = this / other; |
| 66 // this = this % other; | 66 // this = this % other; |
| 67 // In the worst case this function is in O(this/other). | 67 // In the worst case this function is in O(this/other). |
| 68 uint16_t DivideModuloIntBignum(const Bignum& other); | 68 uint16_t DivideModuloIntBignum(const Bignum& other); |
| 69 | 69 |
| 70 bool ToHexString(char* buffer, int buffer_size) const; | 70 bool ToHexString(char* buffer, int buffer_size) const; |
| 71 | 71 |
| 72 // Returns |
| 73 // -1 if a < b, |
| 74 // 0 if a == b, and |
| 75 // +1 if a > b. |
| 72 static int Compare(const Bignum& a, const Bignum& b); | 76 static int Compare(const Bignum& a, const Bignum& b); |
| 73 static bool Equal(const Bignum& a, const Bignum& b) { | 77 static bool Equal(const Bignum& a, const Bignum& b) { |
| 74 return Compare(a, b) == 0; | 78 return Compare(a, b) == 0; |
| 75 } | 79 } |
| 76 static bool LessEqual(const Bignum& a, const Bignum& b) { | 80 static bool LessEqual(const Bignum& a, const Bignum& b) { |
| 77 return Compare(a, b) <= 0; | 81 return Compare(a, b) <= 0; |
| 78 } | 82 } |
| 79 static bool Less(const Bignum& a, const Bignum& b) { | 83 static bool Less(const Bignum& a, const Bignum& b) { |
| 80 return Compare(a, b) < 0; | 84 return Compare(a, b) < 0; |
| 81 } | 85 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 int used_digits_; | 136 int used_digits_; |
| 133 // The Bignum's value equals value(bigits_) * 2^(exponent_ * kBigitSize). | 137 // The Bignum's value equals value(bigits_) * 2^(exponent_ * kBigitSize). |
| 134 int exponent_; | 138 int exponent_; |
| 135 | 139 |
| 136 DISALLOW_COPY_AND_ASSIGN(Bignum); | 140 DISALLOW_COPY_AND_ASSIGN(Bignum); |
| 137 }; | 141 }; |
| 138 | 142 |
| 139 } // namespace double_conversion | 143 } // namespace double_conversion |
| 140 | 144 |
| 141 #endif // DOUBLE_CONVERSION_BIGNUM_H_ | 145 #endif // DOUBLE_CONVERSION_BIGNUM_H_ |
| OLD | NEW |