| 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 24 matching lines...) Expand all Loading... |
| 35 base = 10; | 35 base = 10; |
| 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 #ifdef FOXIT_CHROME_BUILD | |
| 46 abort(); | 45 abort(); |
| 47 #else | 46 |
| 48 » » throw "std::ostream << BigUnsigned: Could not determine the desi
red base from output-stream flags"; | |
| 49 #endif | |
| 50 std::string s = std::string(BigUnsignedInABase(x, base)); | 47 std::string s = std::string(BigUnsignedInABase(x, base)); |
| 51 os << s; | 48 os << s; |
| 52 return os; | 49 return os; |
| 53 } | 50 } |
| 54 | 51 |
| 55 std::ostream &operator <<(std::ostream &os, const BigInteger &x) { | 52 std::ostream &operator <<(std::ostream &os, const BigInteger &x) { |
| 56 if (x.getSign() == BigInteger::negative) | 53 if (x.getSign() == BigInteger::negative) |
| 57 os << '-'; | 54 os << '-'; |
| 58 os << x.getMagnitude(); | 55 os << x.getMagnitude(); |
| 59 return os; | 56 return os; |
| 60 } | 57 } |
| OLD | NEW |