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

Method __sub

Miscellaneous/BigInt.cpp:164–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162 }
163
164 void __sub(const BigInt& v) {
165 for (int i = 0, carry = 0; i < (int) v.a.size() || carry; ++i) {
166 a[i] -= carry + (i < (int) v.a.size() ? v.a[i] : 0);
167 carry = a[i] < 0;
168 if (carry) a[i] += BASE;
169 }
170 this->trim();
171 }
172
173 BigInt operator+=(const BigInt& v) {
174 if (sgn == v.sgn) __add(v);

Callers

nothing calls this directly

Calls 2

trimMethod · 0.95
sizeMethod · 0.45

Tested by

no test coverage detected