[U-Boot-Users] Compiler question: integer division?

Jerry Van Baren gerald.vanbaren at smiths-aerospace.com
Fri Apr 22 19:10:57 CEST 2005


Steven Scholz wrote:
> Hi there,
> 
> I just wondered if the code
> 
>     return (dtt_read(sensor, DTT_READ_TEMP) / 256);
> 
> would be result in a "shift by 8" or and interger division?
> 
> Thanks,
> 
> Steven

Short answer: Yes.

Longer answer: It depends on the compiler, target processor, and 
optimization levels.  Usually it will be a "shift by 8" (which may or 
may not actually be a shift -- see the PowerPC "Swiss Army Knife[tm]" 
instruction rlwimi).

gvb




More information about the U-Boot mailing list