diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/parsing.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/parsing.h b/src/parsing.h index fb9e3547c..c5341c40b 100644 --- a/src/parsing.h +++ b/src/parsing.h @@ -126,10 +126,10 @@ inline Expression* parseConst(cashew::IString s, WasmType type, MixedArena& allo istr >> std::hex >> temp; ret->value = Literal(negative ? -temp : temp); } else { - std::istringstream istr(str); + std::istringstream istr(str[0] == '-' ? str + 1 : str); uint32_t temp; istr >> temp; - ret->value = Literal(temp); + ret->value = Literal(str[0] == '-' ? -temp : temp); } break; } @@ -142,10 +142,10 @@ inline Expression* parseConst(cashew::IString s, WasmType type, MixedArena& allo istr >> std::hex >> temp; ret->value = Literal(negative ? -temp : temp); } else { - std::istringstream istr(str); + std::istringstream istr(str[0] == '-' ? str + 1 : str); uint64_t temp; istr >> temp; - ret->value = Literal(temp); + ret->value = Literal(str[0] == '-' ? -temp : temp); } break; } |