Re: [AD] AMD64 patch

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


Eric Botcazou wrote:

In other places where it didn't really matter either way, I thought it
would be best just to leave them alone.  Then the assumption on the
sizeof(int) can remain as it is now (somewhere between 16-bits and
32-bits) and long can continue to be used to hold values which need
32-bits.  Is there any reason to prefer a 32-bit integer over a 64-bit
integer on a 64-bit machine, e.g. to hold single pixel values?

Alignment I'd say. Every other 32-bit pixel value is not 64-bit aligned so you must be careful when you're dereferencing a pointer to a scanline, although this doesn't really matter on AMD64.

Hmm, then I guess we should use ints internally to hold single pixel values but retain unsigned longs wherever needed in the interface for API compatibility? That can be done after the current patch is applied.

If you could explain your thinking about the alignment a bit more, that would be great. To me it seems like there is not much difference between dereferencing a 32-bit quantity and (i) storing it into a 32-bit register, or (ii) storing it into a 64-bit register. Surely the only difference is that in the latter case the upper 32-bits of the register need to be cleared (or sign-extended)?

Peter




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