I have this macro which, obviously assumes that the provided type is the correct and expected type.

Code:
#define ENCODE_EVENT(devid, info, addr, rshift) do { \ 
       *(uint16_t *)&evt[0] = devid; \
        *(uint8_t *)&evt[3]  = info;  \
        *(uint64_t *)&evt[4] = rshift ? cpu_to_le64(addr) :\
                               cpu_to_le64(addr) >> rshift; \
    } while (0)
I'm currently required to get rid of this macro in the code and I can't help thinking whether I could in a way make it "type safe". Could someone have any ideas ?