Re: divide by 255

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 20, 2000 at 08:19:01PM +0000, Nick Lamb <njl98r@xxxxxxxxxxxxxxx> wrote:
> #define FAST_DIVIDE_BY_255(v) ((((v) << 8) + (v) + 255) >> 16)
> 
> Eerily similar to your hack and to the one from Marc. For me (PII 300,

Yes, but the constant is wrong ;) With the right constant it is exact.

> AMD Duron 700) and for the other hackers on that Moz bug who checked
> it _was_ faster than the GCC emitted alternate, but Marc's numbers
> suggest otherwise.

It would be interesting to find out what gcc is emitting for you. The
mov/mul/mov should not really be slower than the shift/lea/shift, but it
should not be faster, either. So the above macor with the correct constant
would be ideal, IMHO.

-- 
      -----==-                                             |
      ----==-- _                                           |
      ---==---(_)__  __ ____  __       Marc Lehmann      +--
      --==---/ / _ \/ // /\ \/ /       pcg@xxxxxxxxxxxxx |e|
      -=====/_/_//_/\_,_/ /_/\_\       XX11-RIPE         --+
    The choice of a GNU generation                       |
                                                         |


[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux