Divide and C

Doug Gwyn gwyn at smoke.brl.mil
Sun Mar 31 00:15:02 AEST 1991


In article <1991Mar29.182919.20728 at helios.physics.utoronto.ca> neufeld at aurora.physics.utoronto.ca (Christopher Neufeld) writes:
>   Are there compilers which go to the trouble of hardcoding something
>like this if they see division or multiplication by integer powers of
>two, or do they all get lazy and assume a math coprocessor?

Most compilers I've dealt with have optimized integer division and
multiplication by constant powers of two into shift instructions,
but not for floating-point operands.

By the way, it is not necessarily "lazy" to rely on an FPU for speed.
Anyone who has serious floating-point demands is going to get one
anyway.



More information about the Comp.lang.c mailing list