dean gaudet wrote:
you might want to disassemble the functions in gdb (or using objdump) to make sure that gcc emits a single division instruction for the "x / 10", "x % 10" expressions -- i forget the cases where it can and can't do this. the low level div instruction is a two result opcode, quotient and remainder. if it isn't doing it, then figure out how to make it do that and you'll see even more improvement :)
I see one just idivl call in the output of gcc on x86. I assume that means it has done the optimization, right?
--Brian
