mirror of
https://github.com/odin-lang/Odin.git
synced 2026-08-26 06:51:34 +00:00
big_int: base prefix iwth only seperateors and no digits
This commit is contained in:
@@ -218,6 +218,7 @@ gb_internal void big_int_from_string(BigInt *dst, String const &s, bool *success
|
||||
defer (big_int_dealloc(&digit));
|
||||
|
||||
isize i = 0;
|
||||
isize digit_count = 0;
|
||||
for (; i < len; i++) {
|
||||
Rune r = cast(Rune)text[i];
|
||||
|
||||
@@ -241,12 +242,19 @@ gb_internal void big_int_from_string(BigInt *dst, String const &s, bool *success
|
||||
*success = false;
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
digit_count += 1;
|
||||
}
|
||||
|
||||
big_int_from_u64(&digit, v);
|
||||
big_int_mul_eq(dst, &b);
|
||||
big_int_add_eq(dst, &digit);
|
||||
}
|
||||
if (digit_count == 0) {
|
||||
// a base prefix with only digit separators after it, `0x_`, has no digits at all
|
||||
*success = false;
|
||||
return;
|
||||
}
|
||||
if (i < len && (text[i] == 'e' || text[i] == 'E')) {
|
||||
i += 1;
|
||||
if (base != 10) {
|
||||
|
||||
Reference in New Issue
Block a user