I have known about this nicer implementation for a while already, but forgot to actually change the code. Looking at the assembly, it seems that release mode LLVM is smart enough to optimize both versions to the same code. So from a performance perspective, there isn't any improvement. Also, while ilog is used a few times, it isn't really hot code. Even in debug mode I didn't get any performance impact. However, I'd say that the code is simpler this way.