Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: third_party/bigint/BigIntegerUtils.cc

Issue 809513002: XFA: merge patch from issue 801913002 and 804463003 (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/bigint/BigInteger.hh ('k') | third_party/bigint/BigUnsigned.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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)); 46 std::string s = std::string(BigUnsignedInABase(x, base));
51 os << s; 47 os << s;
52 return os; 48 return os;
53 } 49 }
54 50
55 std::ostream &operator <<(std::ostream &os, const BigInteger &x) { 51 std::ostream &operator <<(std::ostream &os, const BigInteger &x) {
56 if (x.getSign() == BigInteger::negative) 52 if (x.getSign() == BigInteger::negative)
57 os << '-'; 53 os << '-';
58 os << x.getMagnitude(); 54 os << x.getMagnitude();
59 return os; 55 return os;
60 } 56 }
OLDNEW
« no previous file with comments | « third_party/bigint/BigInteger.hh ('k') | third_party/bigint/BigUnsigned.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698