I have the following local variable (that will get stored in the stack).
struct test1 {
int a;
int b;
char c;
};
How do I align the starting address of integer a to a 16byte boundary in the stack?
I am running this C code on a custom written MIPS ISA processor.
Here is some non-standard way of aligning your data.
struct test1 *pdata;
// here we assume data on stack is word aligned
pdata = alloca(sizeof(*pdata) + 14);
if (pdata & 0xF)
{
pdata = (unsigned char*)pdata + 16 - (pdata & 0xF);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With