If you don't mind using the ternary operator, I suppose you could do something like this:
if (subControl.inverted) {
newValue = subControl.value+(float)(1.0f/(float)subControl.decorator.ticks);
newValue = newValue > 1 ? 0 : newValue;
} else {
newValue = subControl.value-(float)(1.0f/(float)subControl.decorator.ticks);
newValue = newValue < 0 ? 1 : newValue;
}
Or shorten it further to:
newValue = subControl.value + (subControl.inverted?1:-1) * (float)(1.0f/(float)subControl.decorator.ticks);
if (subControl.inverted) {
newValue = newValue > 1 ? 0 : newValue;
} else {
newValue = newValue < 0 ? 1 : newValue;
}
And if you really want to get funky:
newValue = subControl.value + (subControl.inverted?1:-1) * (float)(1.0f/(float)subControl.decorator.ticks);
newValue = subControl.inverted ? (newValue > 1 ? 0 : newValue)
: (newValue < 0 ? 1 : newValue);
...Not that I think this last version is good - it's a bit harder to follow, and I probably wouldn't use it myself. But it's shorter, which is what you wanted, and I don't know if I can make it any shorter.
If this were golf, here would be the hole-in-one:
newValue = subControl.inverted ? ((subControl.value + (subControl.inverted?1:-1) * (float)(1.0f/(float)subControl.decorator.ticks))> 1 ? 0 : ((subControl.value + (subControl.inverted?1:-1) * (float)(1.0f/(float)subControl.decorator.ticks))< 0 ? 1 : (subControl.value + (subControl.inverted?1:-1) * (float)(1.0f/(float)subControl.decorator.ticks))) );
cleaned up a bit:
newValue = subControl.inverted ?
(
(subControl.value + (subControl.inverted?1:-1) * (float)(1.0f/(float)subControl.decorator.ticks))> 1
? 0
:
(
(subControl.value + (subControl.inverted?1:-1) * (float)(1.0f/(float)subControl.decorator.ticks))< 0
? 1
:
(subControl.value + (subControl.inverted?1:-1) * (float)(1.0f/(float)subControl.decorator.ticks))
)
);
And remember: Just because you can doesn't mean you should!
(I haven't tested this last one, BTW)