On Tue, Jun 2, 2009 at 4:46 PM, Sven Neumann <s...@gimp.org> wrote:
> Hi,
> first of all thanks a lot for providing these patches. I definitely want
> to get them merged as soon as possible. But there are a few minor issues
> that should be discussed first. So let me start by commenting on your
> first patch:
> On Tue, 2009-06-02 at 04:11 -0400, Christopher Montgomery wrote:
>>  #define TILE_DATA_POINTER(tile,x,y) \
>>    ((tile)->data + \
>> -   (((y) % TILE_HEIGHT) * (tile)->ewidth + ((x) % TILE_WIDTH)) *
>> (tile)->bpp)
>> -
>> +   (((y) & (TILE_HEIGHT-1)) * (tile)->ewidth + ((x) &
>> (TILE_WIDTH-1))) * (tile)->bpp)
> As far as I know pretty much any compiler out there should be able to
> replace a modulo by a power-of-2 constant by the bit-wise AND operation
> without us explicitly doing so (see also
> http://en.wikipedia.org/wiki/Modulo_operation#Performance_issues). So
> for the benefit of readable code I suggest that we keep the code as it
> is.

Interesting.  I got a noticable and repeatable performance benefit.
Which is not to say I haven't somehow mismeasured it.  I agree the
modulo is more readable.

...perhaps the difference is the difference of (x) or (y) possibly
being negative and additional conformance-related assembly getting
generated? I suppose there's no reason to speculate, I'll go read the
assembly gcc generates and that will answer everything, at least for

Gimp-developer mailing list

Reply via email to