summaryrefslogtreecommitdiff
path: root/src/ast/properties.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2017-08-02 14:47:05 -0700
committerGitHub <noreply@github.com>2017-08-02 14:47:05 -0700
commitde15161e110f26212095c5cf4faf2e3668d2531b (patch)
tree915e18978f4b554d0479b568378a425ec5b042ee /src/ast/properties.h
parent5a07a930ad51003411b2bc827ea9bf08728ecc5a (diff)
parent6d686bd1a5b3610ad49fd607ae5e49c70410af51 (diff)
downloadbinaryen-de15161e110f26212095c5cf4faf2e3668d2531b.tar.gz
binaryen-de15161e110f26212095c5cf4faf2e3668d2531b.tar.bz2
binaryen-de15161e110f26212095c5cf4faf2e3668d2531b.zip
Merge pull request #1119 from WebAssembly/fuzz-2
More fun fuzz fixes
Diffstat (limited to 'src/ast/properties.h')
-rw-r--r--src/ast/properties.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ast/properties.h b/src/ast/properties.h
index 097f7a8f0..8c8655c07 100644
--- a/src/ast/properties.h
+++ b/src/ast/properties.h
@@ -79,7 +79,7 @@ struct Properties {
// gets the size of the sign-extended value
static Index getSignExtBits(Expression* curr) {
- return 32 - curr->cast<Binary>()->right->cast<Const>()->value.geti32();
+ return 32 - Bits::getEffectiveShifts(curr->cast<Binary>()->right);
}
// Check if an expression is almost a sign-extend: perhaps the inner shift
@@ -93,7 +93,7 @@ struct Properties {
if (auto* inner = outer->left->dynCast<Binary>()) {
if (inner->op == ShlInt32) {
if (auto* innerConst = inner->right->dynCast<Const>()) {
- if (outerConst->value.leU(innerConst->value).geti32()) {
+ if (Bits::getEffectiveShifts(outerConst) <= Bits::getEffectiveShifts(innerConst)) {
return inner->left;
}
}
@@ -109,8 +109,8 @@ struct Properties {
// gets the size of the almost sign-extended value, as well as the
// extra shifts, if any
static Index getAlmostSignExtBits(Expression* curr, Index& extraShifts) {
- extraShifts = curr->cast<Binary>()->left->cast<Binary>()->right->cast<Const>()->value.geti32() -
- curr->cast<Binary>()->right->cast<Const>()->value.geti32();
+ extraShifts = Bits::getEffectiveShifts(curr->cast<Binary>()->left->cast<Binary>()->right) -
+ Bits::getEffectiveShifts(curr->cast<Binary>()->right);
return getSignExtBits(curr);
}