Skip to content

Commit

Permalink
Atomic bitwise complement op without anonymous function. Fixes #688 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
kamphaus authored and elliotchance committed Apr 27, 2018
1 parent bf6946d commit a3608c3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion tests/operators.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ double * return_null(){

int main()
{
plan(98);
plan(99);

int i = 10;
signed char j = 1;
Expand Down Expand Up @@ -380,6 +380,12 @@ int main()
is_eq(x, 3);
is_eq(y, 1);
}
diag("Bitwise complement of array");
{
int a[] = { 0x3c, 0xff };
a[1] &= ~a[0];
is_eq(a[1], 0xc3);
}

done_testing();
}
2 changes: 1 addition & 1 deletion transpiler/operators.go
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ func atomicOperation(n ast.Node, p *program.Program) (
switch v := n.(type) {
case *ast.UnaryOperator:
switch v.Operator {
case "&", "*", "!", "-":
case "&", "*", "!", "-", "~":
return
}
// UnaryOperator 0x252d798 <col:17, col:18> 'double' prefix '-'
Expand Down

0 comments on commit a3608c3

Please sign in to comment.