I have defined a struct type as follows:
#define MAXNUM 100
typedef struct tag_OBJ
{
float val[MAXNUM];
}OBJ;
In my application program, a variable with the struct type OBJ is defined:
OBJ var1;
how to make sure the float vector val in the struct OBJ double word aligned?
Usually, there are two ways to define the float vector double word alignment. If a variable like 'float val[MAXNUM]' is defined in the included file,
and then a macro as '#pragma DATA_ALIGN(val,8)' could be effective to make sure the variable val is double word aligned.
If the dynamic memory allocation for float pointer like 'float *val', it is common to use the memalign function to realize the double word alignment as:
float *val = (float *)memalign(8, sizeof(float) * MAXNUM).