From 8f12d7fb3cdb5138d28ede4bdcd6fa5a7cc9537e Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Wed, 7 Jun 2017 04:22:07 -0700 Subject: [PATCH] ios/net/ip/top: introduce a helper to write ip addr (quiets warning) --- Source/Core/Core/IOS/Network/IP/Top.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Source/Core/Core/IOS/Network/IP/Top.cpp b/Source/Core/Core/IOS/Network/IP/Top.cpp index 2b15ae6e46..b11800e12d 100644 --- a/Source/Core/Core/IOS/Network/IP/Top.cpp +++ b/Source/Core/Core/IOS/Network/IP/Top.cpp @@ -76,6 +76,11 @@ NetIPTop::~NetIPTop() #endif } +static constexpr u32 inet_addr(u8 a, u8 b, u8 c, u8 d) +{ + return (static_cast(a) << 24) | (static_cast(b) << 16) | (static_cast(c) << 8) | d; +} + static int inet_pton(const char* src, unsigned char* dst) { int saw_digit, octets; @@ -818,9 +823,9 @@ IPCCommandResult NetIPTop::HandleGetInterfaceOptRequest(const IOCtlVRequest& req case 0x4003: // ip addr table Memory::Write_U32(0xC, request.io_vectors[1].address); - Memory::Write_U32(10 << 24 | 1 << 8 | 30, request.io_vectors[0].address); - Memory::Write_U32(255 << 24 | 255 << 16 | 255 << 8 | 0, request.io_vectors[0].address + 4); - Memory::Write_U32(10 << 24 | 0 << 16 | 255 << 8 | 255, request.io_vectors[0].address + 8); + Memory::Write_U32(inet_addr(10, 0, 1, 30), request.io_vectors[0].address); + Memory::Write_U32(inet_addr(255, 255, 255, 0), request.io_vectors[0].address + 4); + Memory::Write_U32(inet_addr(10, 0, 255, 255), request.io_vectors[0].address + 8); break; case 0x4005: // hardcoded value