From 41d53cee1f291a989315462815ba00dd522dcf2e Mon Sep 17 00:00:00 2001 From: Weiyi Wang Date: Fri, 21 Sep 2018 21:05:47 -0400 Subject: [PATCH] nwm/uds_data: specify endianness for enum --- src/core/hle/service/nwm/uds_data.cpp | 6 ++---- src/core/hle/service/nwm/uds_data.h | 8 ++++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/core/hle/service/nwm/uds_data.cpp b/src/core/hle/service/nwm/uds_data.cpp index 1f227de6d..57414f343 100644 --- a/src/core/hle/service/nwm/uds_data.cpp +++ b/src/core/hle/service/nwm/uds_data.cpp @@ -26,7 +26,7 @@ using MacAddress = std::array; */ static std::vector GenerateLLCHeader(EtherType protocol) { LLCHeader header{}; - header.protocol = static_cast(protocol); + header.protocol = protocol; std::vector buffer(sizeof(header)); memcpy(buffer.data(), &header, sizeof(header)); @@ -313,9 +313,7 @@ std::vector GenerateEAPoLStartFrame(u16 association_id, const NodeInfo& node EtherType GetFrameEtherType(const std::vector& frame) { LLCHeader header; std::memcpy(&header, frame.data(), sizeof(header)); - - u16 ethertype = header.protocol; - return static_cast(ethertype); + return header.protocol; } u16 GetEAPoLFrameType(const std::vector& frame) { diff --git a/src/core/hle/service/nwm/uds_data.h b/src/core/hle/service/nwm/uds_data.h index 59906f677..2ebd416b4 100644 --- a/src/core/hle/service/nwm/uds_data.h +++ b/src/core/hle/service/nwm/uds_data.h @@ -26,11 +26,11 @@ enum class EtherType : u16 { SecureData = 0x876D, EAPoL = 0x888E }; * and the OUI is always 0. */ struct LLCHeader { - u8 dsap = static_cast(SAP::SNAPExtensionUsed); - u8 ssap = static_cast(SAP::SNAPExtensionUsed); - u8 control = static_cast(PDUControl::UnnumberedInformation); + SAP dsap = SAP::SNAPExtensionUsed; + SAP ssap = SAP::SNAPExtensionUsed; + PDUControl control = PDUControl::UnnumberedInformation; std::array OUI = {}; - u16_be protocol; + enum_be protocol; }; static_assert(sizeof(LLCHeader) == 8, "LLCHeader has the wrong size");