Skip to content

Commit ff5f7fa

Browse files
committed
uint8_t, bool and char are not converted, as they are already in host byte order.
1 parent 4d8da6a commit ff5f7fa

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

include/DMDUtil/DMD.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ class DMDUTILAPI DMD
131131

132132
void convertToHostByteOrder()
133133
{
134+
// uint8_t and bool are not converted, as they are already in host byte order.
134135
mode = static_cast<Mode>(ntohl(static_cast<uint32_t>(mode)));
135136
layout = static_cast<AlphaNumericLayout>(ntohl(static_cast<uint32_t>(layout)));
136137
depth = ntohl(depth);
@@ -148,6 +149,7 @@ class DMDUTILAPI DMD
148149

149150
Update toNetworkByteOrder() const
150151
{
152+
// uint8_t and bool are not converted, as they are already in network byte order.
151153
Update copy = *this;
152154
copy.mode = static_cast<Mode>(htonl(static_cast<uint32_t>(mode)));
153155
copy.layout = static_cast<AlphaNumericLayout>(htonl(static_cast<uint32_t>(layout)));
@@ -179,24 +181,20 @@ class DMDUTILAPI DMD
179181

180182
void convertToHostByteOrder()
181183
{
182-
version = ntohs(version);
184+
// uint8_t and char are not converted, as they are already in host byte order.
183185
mode = static_cast<Mode>(ntohl(static_cast<uint32_t>(mode)));
184186
width = ntohs(width);
185187
height = ntohs(height);
186188
length = ntohl(length);
187-
buffered = ntohs(buffered);
188-
disconnectOthers = ntohs(disconnectOthers);
189189
}
190190

191191
void convertToNetworkByteOrder()
192192
{
193-
version = htons(version);
193+
// uint8_t and char are not converted, as they are already in network byte order.
194194
mode = static_cast<Mode>(htonl(static_cast<uint32_t>(mode)));
195195
width = htons(width);
196196
height = htons(height);
197197
length = htonl(length);
198-
buffered = htons(buffered);
199-
disconnectOthers = htons(disconnectOthers);
200198
}
201199
};
202200

0 commit comments

Comments
 (0)