| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code by Matt McCutchen, see the LICENSE file. | 5 // Original code by Matt McCutchen, see the LICENSE file. |
| 6 | 6 |
| 7 #include "BigIntegerUtils.hh" | 7 #include "BigIntegerUtils.hh" |
| 8 #include "BigUnsignedInABase.hh" | 8 #include "BigUnsignedInABase.hh" |
| 9 | 9 |
| 10 std::string bigUnsignedToString(const BigUnsigned &x) { | 10 std::string bigUnsignedToString(const BigUnsigned &x) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 else if (osFlags & os.hex) { | 36 else if (osFlags & os.hex) { |
| 37 base = 16; | 37 base = 16; |
| 38 if (osFlags & os.showbase) | 38 if (osFlags & os.showbase) |
| 39 os << "0x"; | 39 os << "0x"; |
| 40 } else if (osFlags & os.oct) { | 40 } else if (osFlags & os.oct) { |
| 41 base = 8; | 41 base = 8; |
| 42 if (osFlags & os.showbase) | 42 if (osFlags & os.showbase) |
| 43 os << '0'; | 43 os << '0'; |
| 44 } else | 44 } else |
| 45 abort(); | 45 abort(); |
| 46 |
| 46 std::string s = std::string(BigUnsignedInABase(x, base)); | 47 std::string s = std::string(BigUnsignedInABase(x, base)); |
| 47 os << s; | 48 os << s; |
| 48 return os; | 49 return os; |
| 49 } | 50 } |
| 50 | 51 |
| 51 std::ostream &operator <<(std::ostream &os, const BigInteger &x) { | 52 std::ostream &operator <<(std::ostream &os, const BigInteger &x) { |
| 52 if (x.getSign() == BigInteger::negative) | 53 if (x.getSign() == BigInteger::negative) |
| 53 os << '-'; | 54 os << '-'; |
| 54 os << x.getMagnitude(); | 55 os << x.getMagnitude(); |
| 55 return os; | 56 return os; |
| 56 } | 57 } |
| OLD | NEW |