I need to allocate an integer array in stack in my function, how can I make it 32 bits aligned?
void f1() {
uint8_t slope[4*32];
}
I am running on linux.
I need to allocate an integer array in stack in my function, how can I make it 32 bits aligned?
void f1() {
uint8_t slope[4*32];
}
I am running on linux.
This should work across most (all?) architectures and doesn't require compiler-specific techniques, although I will admit to not being sure what the implications of this declaration being local versus global/file-scope.
void f1(void)
{
union
{
uint32_t align;
uint8_t arr[4*32];
} slope;
/* can now be access via slope.arr[] */
}