summaryrefslogtreecommitdiff
path: root/src/literal.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/literal.h')
-rw-r--r--src/literal.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/literal.h b/src/literal.h
index d94d1a6d0..625b3eb43 100644
--- a/src/literal.h
+++ b/src/literal.h
@@ -114,6 +114,18 @@ public:
WASM_UNREACHABLE("unexpected type");
}
}
+ bool isNegative() const {
+ switch (type.getBasic()) {
+ case Type::i32:
+ case Type::f32:
+ return i32 < 0;
+ case Type::i64:
+ case Type::f64:
+ return i64 < 0;
+ default:
+ WASM_UNREACHABLE("unexpected type");
+ }
+ }
bool isSignedMin() const {
switch (type.getBasic()) {
case Type::i32: