MCPcopy Create free account
hub / github.com/ShahjalalShohag/code-library / __add

Method __add

Miscellaneous/BigInt.cpp:154–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152 }
153
154 void __add(const BigInt& v) {
155 if (a.size() < v.a.size()) a.resize(v.a.size(), 0);
156 for (int i = 0, carry = 0; i < max(a.size(), v.a.size()) || carry; ++i) {
157 if (i == a.size()) a.push_back(0);
158 a[i] += carry + (i < (int) v.a.size() ? v.a[i] : 0);
159 carry = a[i] >= BASE;
160 if (carry) a[i] -= BASE;
161 }
162 }
163
164 void __sub(const BigInt& v) {
165 for (int i = 0, carry = 0; i < (int) v.a.size() || carry; ++i) {

Callers

nothing calls this directly

Calls 3

resizeMethod · 0.80
push_backMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected