Skip to content

Commit

Permalink
Merge pull request HaxeFoundation#3899 from Herschel/swf9-uint-shift
Browse files Browse the repository at this point in the history
[swf9] Fix UInt shift behavior
  • Loading branch information
ncannasse committed Feb 22, 2015
2 parents 672fb6d + f472a21 commit 8580926
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 6 additions & 1 deletion genswf9.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1633,10 +1633,15 @@ and gen_binop ctx retval op e1 e2 t p =
gen_expr ctx true e2;
write_op op;
setvar ctx wacc (if retval then Some (classify ctx e1.etype) else None)
| OpAdd | OpMult | OpDiv | OpSub | OpAnd | OpOr | OpXor | OpShl | OpShr | OpUShr | OpMod ->
| OpAdd | OpMult | OpDiv | OpSub | OpAnd | OpOr | OpXor | OpMod ->
gen_expr ctx true e1;
gen_expr ctx true e2;
write_op op
| OpShl | OpShr | OpUShr ->
gen_expr ctx true e1;
gen_expr ctx true e2;
write_op op;
coerce ctx (classify ctx e1.etype)
| OpEq ->
gen_eq()
| OpNotEq ->
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/src/unit/issues/Issue2736.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class Issue2736 extends Test {
t( a > 1.0 ); t( a >= 1.0 );
f( a < -1.0 ); f( a <= 1.0 );

// Shift behavior
eq( '${a >> 1}', "3397483648" );

/* These are currently broken but should be fixed in the future:
* Currently we don't allow UInt vs Int comparisons.
* trace(a == -1794967296);
Expand Down

0 comments on commit 8580926

Please sign in to comment.