Skip to content

Commit

Permalink
Changed to if constexpr to work around C4127 error
Browse files Browse the repository at this point in the history
  • Loading branch information
gnawme committed Feb 8, 2023
1 parent 3eda754 commit b78b682
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/SFML/Network/Packet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class SFML_NETWORK_API Packet
if (checkSize(sizeof(data)))
{
std::memcpy(&data, &m_data[m_readPos], sizeof(data));
if (sizeof(T) > 1)
if constexpr (sizeof(T) > 1)
{
data = swapEndian(data);
}
Expand Down Expand Up @@ -307,7 +307,7 @@ class SFML_NETWORK_API Packet
Packet& operator<<(T& data)
{
auto toWrite = data;
if (sizeof(T) > 1)
if constexpr (sizeof(T) > 1)
{
toWrite = swapEndian(data);
}
Expand Down

0 comments on commit b78b682

Please sign in to comment.