align struct member for SSE with "new" operator?

align struct member for SSE with "new" operator?

i have those code

#define CACHELINE 64
#define ALIGNMENT 16
#define ALIGNC __declspec(align(CACHELINE))
#define ALIGN __declspec(align(ALIGNMENT))

struct Vector4
{
EFIXED V[3];
EFIXED FILL;
};

typedef ALIGN struct Vector4 VECTOR3;

ALIGNC struct SectorObject
{
.
.
.
many other members
.
VECTOR3 O_Glide;
.
.
.
}

SectorObject also has a constructor

in the code this object is created using "new"

.
struct SectorObject *pobj = new SectorObject;
.

my problem is that "O_Glide" is not 16 byte aligned and i cant use aligned SSE memory read/writes.

The question is how can i align "O_Glide" correctly?

I know i can use _aligned_malloc but this wont call the constructor. So is there a easy solution for this "common" problem?

1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.