Have you ever noticed that chicken legs always come in packages in odd numbers, like 5 or 7? That means there is a one legged chicken hopping around somewhere.
switch (direction) {
case 1: range += (bool)(range^255); break;
case 2: range -= (bool)range;
}