in the spirit of [graphics.stanford.edu/~seander/bithacks.html](http://graphics.stanford.edu/~seander/bithacks.html) I need to solve the following problem:

```
int x; 
int pow2; // always a positive power of 2
int sgn;  // always either 0 or 1
// ...
// ...
if(sgn == 0)
    x -= pow2;
else
    x += pow2;

```

Of course I need to avoid the conditional. So far the best I came up with is

```
x -= (1|(~sgn+1))*pow2

```

but that involves a multiplication which I also would like to avoid. Thanks in advance.

EDIT: Thanks all,

```
x -= (pow2^-sgn) + sgn

```

seems to do the trick!