When you make optimization you need to do intermediate calclulation _exactly_ the same way the target machine does.
Even if the number is ascii or unicode string, you need to do the computations strictly same way s target machine does, otherwise you'd break assumptions of the programmer, and lead to unreproducible code.