You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
intget_val(char c) {
assert(('0' <= c and c <= '9') or ('a' <= c and c <= 'f'));
if ('0' <= c and c <= '9')
return c - '0';
elsereturn c - 'a' + 10;
}
BigInt hex_to_BigInt(const std::string& hex) {
assert(!hex.empty());
BigInt res = 0, p = 1;
for (auto it = hex.rbegin(); it != hex.rend(); it++) {
res += p * get_val(*it);
p *= 16;
}
return res;
}
I had something similar to this in mind. Do we have any library specific optimizations?
Obviously we would need to handle lots of edge cases in original implementation.
BigInt header only does not work with hexdigit string like
std::string hexStr = "123456789abcdef123456789abcdef";
It is very kind of you to extend it.
Best thanks
The text was updated successfully, but these errors were encountered: