I am currently writing a small part of an embedded OS, where I some times need to assign all the variables in a large struct to 0. The elements range from uint8 to uint64. As of now, the only thing I have gotten to work, is to loop through each of the types of variables, assigning each of them to 0, but this takes many cycles and the code is "ugly". I was thinking if it was possible to make a pointer of the type of the struct, and then assigning the value of the pointed element to 0, as that element should have the size sizeof(MyStruct)?
The struct to assign to 0:
struct AMD64Context{
uint8_t fp_context[512] __attribute__((alligned(16)));
uint64_t rax;
....
....
};