Though you should always ask what your compiler/optimizer is doing for you. Research into how to turn your ifs into arithmetic is ongoing. If the compiler can optimize your simple ifs into the complex arithmetic then you should go with the simple if and let the compiler do that. (unfortunately in many cases the compiler cannot be sure because of some special case - even though odds are you don't care about it)