The old code wasn't doing what it promised to do
and failed to remove these expressions.
Change-Id: I6718539fd528f293db537e47ff1c9ac4b27ada55
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Expr *casted = 0;
switch (binop->op) {
case OpBitAnd:
- if (leftConst && !rightConst && leftConst->value == 0xffffffff)
- casted = rightConst;
- else if (!leftConst && rightConst && rightConst->value == 0xffffffff)
- casted = leftConst;
+ if (leftConst && !rightConst && QV4::Primitive::toUInt32(leftConst->value) == 0xffffffff)
+ casted = binop->right;
+ else if (!leftConst && rightConst && QV4::Primitive::toUInt32(rightConst->value) == 0xffffffff)
+ casted = binop->left;
break;
case OpBitOr:
- if (leftConst && !rightConst && leftConst->value == 0)
- casted = rightConst;
- else if (!leftConst && rightConst && rightConst->value == 0)
- casted = leftConst;
+ if (leftConst && !rightConst && QV4::Primitive::toInt32(leftConst->value) == 0)
+ casted = binop->right;
+ else if (!leftConst && rightConst && QV4::Primitive::toUInt32(rightConst->value) == 0)
+ casted = binop->left;
break;
default:
break;