diff --git a/Source/Core/Core/HW/SI/SI_DeviceAMBaseboard.cpp b/Source/Core/Core/HW/SI/SI_DeviceAMBaseboard.cpp index 4fb5c40d2a..2c5beca98e 100644 --- a/Source/Core/Core/HW/SI/SI_DeviceAMBaseboard.cpp +++ b/Source/Core/Core/HW/SI/SI_DeviceAMBaseboard.cpp @@ -174,11 +174,12 @@ void CSIDevice_AMBaseboard::ICCardSendReply(ICCommand* iccommand, u8* buffer, u3 { iccommand->status = Common::swap16(iccommand->status); - const u8 crc = CheckSumXOR(iccommand->data + 2, iccommand->pktlen - 1); + const auto iccommand_data = reinterpret_cast(iccommand); + const u8 crc = CheckSumXOR(iccommand_data + 2, iccommand->pktlen - 1); for (u32 i = 0; i < iccommand->pktlen + 1; ++i) { - buffer[(*length)++] = iccommand->data[i]; + buffer[(*length)++] = iccommand_data[i]; } buffer[(*length)++] = crc; diff --git a/Source/Core/Core/HW/SI/SI_DeviceAMBaseboard.h b/Source/Core/Core/HW/SI/SI_DeviceAMBaseboard.h index 35ec5c4448..acbf57e21b 100644 --- a/Source/Core/Core/HW/SI/SI_DeviceAMBaseboard.h +++ b/Source/Core/Core/HW/SI/SI_DeviceAMBaseboard.h @@ -239,23 +239,20 @@ private: ProgramVersion = 0x76, }; - union ICCommand + // NOTE: Used to be an union with `u8 data[81 + 4 + 4 + 4]` + // TODO: Should the struct be packed? + struct ICCommand { - u8 data[81 + 4 + 4 + 4] = {}; + u32 pktcmd : 8; + u32 pktlen : 8; + u32 fixed : 8; + u32 command : 8; + u32 flag : 8; + u32 length : 8; + u32 status : 16; - struct - { - u32 pktcmd : 8; - u32 pktlen : 8; - u32 fixed : 8; - u32 command : 8; - u32 flag : 8; - u32 length : 8; - u32 status : 16; - - u8 extdata[81]; - u32 extlen; - }; + u8 extdata[81]; + u32 extlen; }; u8 m_last[2][0x80] = {};