fix: parseInt was broken

This commit is contained in:
TopchetoEU 2024-12-13 02:26:34 +02:00
parent 00aeef5321
commit bce8b7293c
Signed by: topchetoeu
GPG Key ID: 6531B8583E5F6ED4

View File

@ -402,12 +402,13 @@ public class Parsing {
} }
while (true) { while (true) {
var digit = alphabet.indexOf(Character.toLowerCase(src.at(i + n))); var digit = alphabet.indexOf(Character.toLowerCase(src.at(i + n, '\0')));
if (digit < 0) break; if (digit < 0) break;
parsedAny = true; parsedAny = true;
result += digit;
result *= alphabet.length(); result *= alphabet.length();
result += digit;
n++;
} }
if (!parsedAny) { if (!parsedAny) {
@ -415,6 +416,6 @@ public class Parsing {
return ParseRes.failed(); return ParseRes.failed();
} }
else if (negative) return ParseRes.res(-result, n); else if (negative) return ParseRes.res(-result, n);
else return ParseRes.res(-result, n); else return ParseRes.res(result, n);
} }
} }