From b59a6c0557d0f897887d0287f473490842222a3b Mon Sep 17 00:00:00 2001 From: Michael Mikonos Date: Mon, 30 Oct 2023 16:20:24 +0800 Subject: [PATCH] rewrite radix detection loop as while --- src/Kernel/StrScan.ZC | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/src/Kernel/StrScan.ZC b/src/Kernel/StrScan.ZC index 81ab28ec..e8e859a1 100755 --- a/src/Kernel/StrScan.ZC +++ b/src/Kernel/StrScan.ZC @@ -15,24 +15,19 @@ I64 Str2I64(U8 *st, I64 radix=10, U8 **_end_ptr=NULL) st++; if (*st == '+' || *st == '-') neg = *st++ == '-'; - while (TRUE) - switch (*st) - { - case '0': - st++; - ch = ToUpper(*st); - if (ch >= 'B' && (radix <= 10 || ch > 'A' + radix - 11)) - switch (ch) - { - case 'B': radix = 2; st++; break; - case 'O': radix = 8; st++; break; - case 'D': radix = 10; st++; break; - case 'X': radix = 16; st++; break; - } - default: - goto ai_cont; - } -ai_cont: + while (*st == '0') + { + st++; + ch = ToUpper(*st); + if (ch >= 'B' && (radix <= 10 || ch > 'A' + radix - 11)) + switch (ch) + { + case 'B': radix = 2; st++; break; + case 'O': radix = 8; st++; break; + case 'D': radix = 10; st++; break; + case 'X': radix = 16; st++; break; + } + } while (ch = ToUpper(*st++)) { if (radix > 10)