[cairo] Data alignment and SSE2

André Tupinambá andrelrt at gmail.com
Wed Mar 12 13:20:38 PDT 2008


To execute SSE2 load and store instructions the fastest way is
accessing memory address on a 16-byte boundary, but my function must
work with any aligned data. So I create some code to read the head and
tail of unaligned DWORDs. There's ok, and everything works fine.

Well... Whats happen if the data address is something like 0x00400001?
This address isn't 4-byte aligned, so reading DWORD after DWORD I'll
never get a 16-bytes aligned address. I can still use SSE2, but I need
to load and save data with unaligned instructions (slower than the
aligned ones).

The question is: Can I expect that all data is 4-byte aligned or I
need to check if the address is 4-byte aligned?

Best Regards

André Tupinambá

More information about the cairo mailing list