O
Olaf Baeyens
I am porting some of my buffer class code for C++ to C#.
This C++ class allocates a block of memory using
m_pBuffer=new BYTE[...];
But since the class is also used for pointers for funtions that uses raw MMX
and SSE power, the starting pointer MUST be starting at a 16 byte memory
boundary.
In C++ I allocate more memory than needed, and in a second phase I search
for the address that starts on a 16 byte boundary. And I then use that new
memory address pointer.
Is there a way to make C# to always align a "byte[] Buffer=new byte[132];"
dynamically to a 16 byte memory address?
[StructLayout(LayoutKind.???)] ???
I am not talking about the location of &Buffer but about the location of
&(new byte[132]).
It would be nice if I could decide to make parts of my code aligned on 16
bytes and the rest on normal 8 bytes or 32 byte depending on the need and
not force all uses of Buffer to be alignend on 16 bytes..
This C++ class allocates a block of memory using
m_pBuffer=new BYTE[...];
But since the class is also used for pointers for funtions that uses raw MMX
and SSE power, the starting pointer MUST be starting at a 16 byte memory
boundary.
In C++ I allocate more memory than needed, and in a second phase I search
for the address that starts on a 16 byte boundary. And I then use that new
memory address pointer.
Is there a way to make C# to always align a "byte[] Buffer=new byte[132];"
dynamically to a 16 byte memory address?
[StructLayout(LayoutKind.???)] ???
I am not talking about the location of &Buffer but about the location of
&(new byte[132]).
It would be nice if I could decide to make parts of my code aligned on 16
bytes and the rest on normal 8 bytes or 32 byte depending on the need and
not force all uses of Buffer to be alignend on 16 bytes..