16 Byte alignment support
-
I would like to align some static variables (floats) to 16 byte boundary's so I can use SSE instructions to speed up calculations. In microsoft visual C++ this is very simple: __declspec(align(16)) float A[65536]; &A[0]=0x???????0 But for my current project I have to use Borland C++ compiler. The Borland compiler does not support the align keyword. It is very easy to align dynamic variables to 16 byte boundary's using the function VirtualAlloc: lpAddress=VirtualAlloc(NULL,65536*4,MEM_COMMIT,PAGE_READWRITE); lpAddress=0x????0000 But if it is possible I would like to use static variables. I have tryed the following: typedef struct { CHAR cPadding[16]; }PADDING; #pragma pack(16) PADDING padding; FLOAT A[65536]; #pragma pack() #pragma pack(16) LONG DOUBLE padding1; LONG padding2; SHORT padding3; FLOAT A[65536]; #pragma pack() but this does not work. Does anyone have experience with this?? Thank You in advance:)