summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-11-04 21:03:47 -0800
committerAlon Zakai <alonzakai@gmail.com>2015-11-04 21:03:47 -0800
commit578461d1ad4fe34235f67016d703f568fdf92c6a (patch)
treea236b62b611713ca408ff1ca0cf3f20eabbd5e45 /src
parent8bc2c03d245df4eab03f6545d55a9f2d34c261a3 (diff)
downloadbinaryen-578461d1ad4fe34235f67016d703f568fdf92c6a.tar.gz
binaryen-578461d1ad4fe34235f67016d703f568fdf92c6a.tar.bz2
binaryen-578461d1ad4fe34235f67016d703f568fdf92c6a.zip
numeric fixes
Diffstat (limited to 'src')
-rw-r--r--src/wasm-interpreter.h2
-rw-r--r--src/wasm-s-parser.h8
-rw-r--r--src/wasm.h2
3 files changed, 8 insertions, 4 deletions
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h
index f412e2afb..7af64e336 100644
--- a/src/wasm-interpreter.h
+++ b/src/wasm-interpreter.h
@@ -354,7 +354,7 @@ public:
Literal value = flow.value;
switch (curr->op) { // :-)
case ExtendSInt32: return Flow(Literal(int64_t(value.geti32())));
- case ExtendUInt32: return Flow(Literal(int64_t((uint32_t)value.geti32())));
+ case ExtendUInt32: return Flow(Literal(uint64_t((uint32_t)value.geti32())));
case WrapInt64: return Flow(Literal(int32_t(value.geti64())));
case TruncSFloat32: return Flow(Literal(int32_t(value.getf32())));
case TruncUFloat32: return Flow(Literal(uint32_t(value.getf32())));
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h
index e35f081c4..7747e1a97 100644
--- a/src/wasm-s-parser.h
+++ b/src/wasm-s-parser.h
@@ -499,7 +499,9 @@ private:
case i32: {
int32_t temp;
if (str[0] == '0' && str[1] == 'x') {
- istr >> std::hex >> temp;
+ uint32_t temp2;
+ istr >> std::hex >> temp2;
+ temp = temp2;
} else {
istr >> temp;
}
@@ -509,7 +511,9 @@ private:
case i64: {
int64_t temp;
if (str[0] == '0' && str[1] == 'x') {
- istr >> std::hex >> temp;
+ uint64_t temp2;
+ istr >> std::hex >> temp2;
+ temp = temp2;
} else {
istr >> temp;
}
diff --git a/src/wasm.h b/src/wasm.h
index f7f6ce6b5..2c78182f8 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -117,7 +117,7 @@ struct Literal {
bool operator==(Literal& other) {
if (type != other.type) return false;
if (type == none) return true;
- if (type == i32 || type == f32) return i32 == other.i32;
+ if (type == WasmType::i32 || type == WasmType::f32) return i32 == other.i32;
return i64 == other.i64;
}