feat(big): add SBigFromStr

This commit is contained in:
Adam Heinermann 2024-11-15 03:50:22 -08:00 committed by superp00t
parent fac094793a
commit 896c3c0414
5 changed files with 42 additions and 0 deletions

View file

@ -167,6 +167,14 @@ void FromBinary(BigBuffer& buffer, const void* data, uint32_t bytes) {
}
}
void FromStr(BigBuffer& buffer, const char* str) {
SetZero(buffer);
for (; *str; str++) {
Mul(buffer, buffer, 10);
Add(buffer, buffer, *str - '0');
}
}
void FromUnsigned(BigBuffer& buffer, uint32_t value) {
buffer[0] = value;
buffer.SetCount(1);