diff --git a/src/Lib/Script/FrontEnd/StrV.cc b/src/Lib/Script/FrontEnd/StrV.cc index 60bfa036428751f444b81540c8e02d9f290c2afe..19c6961f514e791aecee8576297c55a2d214111f 100644 --- a/src/Lib/Script/FrontEnd/StrV.cc +++ b/src/Lib/Script/FrontEnd/StrV.cc @@ -412,7 +412,8 @@ StrV::tryChopInteger(int *ret, int *amount) noexcept char c = sv.data[0]; if (c < '0' || c > '9') break; - total = (total * 10) + (c - '0'); + total *= 10; + total += (c - '0'); sv.chopLeft(1); *amount += 1; } @@ -420,7 +421,7 @@ StrV::tryChopInteger(int *ret, int *amount) noexcept if ((negative && *amount <= 1) || (*amount == 0)) return false; - *ret = (negative * (-1 * total)) + (negative * total); + *ret = negative ? (-1 * total) : total; *this = sv; return true; }