[AD] aligned_malloc() vs malloc()

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


Evert Glebbeek wrote:

>>> so if i was to ensure the dat was large enough, then set all the line
>>> ptrs to aligned addresses, the rest of allegro should work just fine ?
>>> or do some functions use  dat[y*pitch+w]  arithmetic?
>>
>>
>>
>> It should, in theory. I don't think anything in Allegro depends on
>> dat[], but one can never be too sure. You can just try it and see if you
>> find corruption in some of the tests.
>
> > Any more news on this?
>
> Evert



[context MSVC7]

i have been considering options.
i wanted to do a search and replace on malloc() and change them all to aligned_malloc() until i found al_malloc() which im still not sure what it does.

then there was another issue.. for every aligned_malloc() there needs to be an aligned_free() doing a search & replace on the word "free" was going to clobber a whole bunch of other stuff.

using aligned_malloc() alone *may* not be a complete solution to moving toward safe SSE2 coding.. data within structures needs to be 16 byte aligned, which can be achieved by specifying a packing option in the compiler, however thats not going to fix arrays of data that use a[y*pitch+x] methods. bitmap->dat would need to have a 16byte aligned stride.

its a bigger issue than i first thought, its something i want to persue but it really makes the whole codebase P4/Athlon/SSE2 as minimum spec, something the rest of the allegro world is not ready for.

my igo ran a muck this morning, when it declared i would take the 4.1.19 as soon as it was released, make all the aligned_malloc() changes then declare myself cheif overlord of a P4/Athlon/SSE2 class allegro branch, which lasted as long as breakfast. my overlording is not to be :( mostly due to that trait that is stongest amongst us humans, lazyness :>

aj.




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