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

Side by Side Diff: third_party/bigint/BigIntegerAlgorithms.hh

Issue 773443004: Initial check in of big integer library (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
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/BigIntegerAlgorithms.cc ('k') | third_party/bigint/BigIntegerLibrary.hh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #ifndef BIGINTEGERALGORITHMS_H
2 #define BIGINTEGERALGORITHMS_H
3
4 #include "BigInteger.hh"
5
6 /* Some mathematical algorithms for big integers.
7 * This code is new and, as such, experimental. */
8
9 // Returns the greatest common divisor of a and b.
10 BigUnsigned gcd(BigUnsigned a, BigUnsigned b);
11
12 /* Extended Euclidean algorithm.
13 * Given m and n, finds gcd g and numbers r, s such that r*m + s*n == g. */
14 void extendedEuclidean(BigInteger m, BigInteger n,
15 BigInteger &g, BigInteger &r, BigInteger &s);
16
17 /* Returns the multiplicative inverse of x modulo n, or throws an exception if
18 * they have a common factor. */
19 BigUnsigned modinv(const BigInteger &x, const BigUnsigned &n);
20
21 // Returns (base ^ exponent) % modulus.
22 BigUnsigned modexp(const BigInteger &base, const BigUnsigned &exponent,
23 const BigUnsigned &modulus);
24
25 #endif
OLDNEW
« no previous file with comments | « third_party/bigint/BigIntegerAlgorithms.cc ('k') | third_party/bigint/BigIntegerLibrary.hh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698