| AWARE [SYSTEMS] | Imaging expertise for the Delphi developer | |||||||
![]() |
TIFF and LibTiff Mailing List Archive | |||||||
LibTiff Mailing List
TIFF and LibTiff Mailing List Archive Contact
The TIFF Mailing List Homepage |
Thread2009.11.03 20:46 "Re: Tiffcrop test suite and logluv issues", by Daniel MccoyFrom Toby Thain <toby@telegraphics.com.au>, Tue, Nov 03, 2009 at 07:16:07AM -0500: > > > > Alternatively one could write: > > tp[i] = 65536 * bp[0] + 256 * bp[1] + bp[2]; > > > > Compilers today transform the power-of-two multiplications into rather > > effective code (read: shift lefts) and it doesn't require parens. > > This adds to the cognitive load for humans. A shift shows the intent > more clearly. True. One way of reducing the cognitive load in the multiply version is to use hex constants: tp[i] = 0x10000 * bp[0] + 0x100 * bp[1] + bp[2]; which show the intent more clearly than the decimal constants. |
|||||||