Re: [AD] bug in getpixel

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 2005-11-28, Vincent Penecherc'h <Vincent.Penecherch@xxxxxxxxxx> wrote:
> > I don't understand the rationale behind adding just one byte. Say
> > I wanted a bitmap of 3x1 pixels, which will malloc 3 * 1 * 3 =
> > 9 bytes. Adding one makes it 10, but wouldn't alignment rules
> > require 12? How about 64bit machines? I guess we haven't asm for
> > them, but surely that will be a problem too (some day)?
> 
> The problem is that, to read the very last pixel of the BITMAP of
> 24 bit depth, the asm will read 4 bytes (as it does every pixel),
> and the 4th will lie outside the malloc'd area (eg, for every pixel,
> it reads an extra byte, which usually happen to be part of the
> next pixel, but the last pixel doesn't have a next pixel). That
> extra byte is and'd away, but it still reads it.
> 
> > Besides, you could comment it better:
> 
> Good point, here's a better comment:

Committed (4.2 and 4.3).

Peter





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/