Optimize the conversion of a digit to an integer