Fix compilation on linux gcc
This commit is contained in:
parent
ee5cb9c7b9
commit
ec407bd3f1
6 changed files with 32 additions and 31 deletions
|
@ -14,13 +14,13 @@
|
|||
namespace Network {
|
||||
|
||||
#ifndef htonll
|
||||
u64 htonll(u64 x) {
|
||||
static u64 htonll(u64 x) {
|
||||
return ((1 == htonl(1)) ? (x) : ((uint64_t)htonl((x)&0xFFFFFFFF) << 32) | htonl((x) >> 32));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef ntohll
|
||||
u64 ntohll(u64 x) {
|
||||
static u64 ntohll(u64 x) {
|
||||
return ((1 == ntohl(1)) ? (x) : ((uint64_t)ntohl((x)&0xFFFFFFFF) << 32) | ntohl((x) >> 32));
|
||||
}
|
||||
#endif
|
||||
|
@ -67,7 +67,7 @@ Packet::operator bool() const {
|
|||
}
|
||||
|
||||
Packet& Packet::operator>>(bool& out_data) {
|
||||
u8 value;
|
||||
u8 value{};
|
||||
if (*this >> value) {
|
||||
out_data = (value != 0);
|
||||
}
|
||||
|
@ -85,42 +85,42 @@ Packet& Packet::operator>>(u8& out_data) {
|
|||
}
|
||||
|
||||
Packet& Packet::operator>>(s16& out_data) {
|
||||
s16 value;
|
||||
s16 value{};
|
||||
Read(&value, sizeof(value));
|
||||
out_data = ntohs(value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Packet& Packet::operator>>(u16& out_data) {
|
||||
u16 value;
|
||||
u16 value{};
|
||||
Read(&value, sizeof(value));
|
||||
out_data = ntohs(value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Packet& Packet::operator>>(s32& out_data) {
|
||||
s32 value;
|
||||
s32 value{};
|
||||
Read(&value, sizeof(value));
|
||||
out_data = ntohl(value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Packet& Packet::operator>>(u32& out_data) {
|
||||
u32 value;
|
||||
u32 value{};
|
||||
Read(&value, sizeof(value));
|
||||
out_data = ntohl(value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Packet& Packet::operator>>(s64& out_data) {
|
||||
s64 value;
|
||||
s64 value{};
|
||||
Read(&value, sizeof(value));
|
||||
out_data = ntohll(value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Packet& Packet::operator>>(u64& out_data) {
|
||||
u64 value;
|
||||
u64 value{};
|
||||
Read(&value, sizeof(value));
|
||||
out_data = ntohll(value);
|
||||
return *this;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue