1
0
Fork 0

fixes for MSVC

This commit is contained in:
jsteemann 2017-09-01 13:24:44 +02:00
parent 81b4a3896b
commit 0537eb95bc
2 changed files with 13 additions and 13 deletions

View File

@ -61,7 +61,7 @@ inline uint16_t hostToLittle(uint16_t in){
return OSSwapHostToLittleInt16(in);
#elif __linux__
return htole16(in);
#elif __WIN32
#elif _WIN32
if(!isLittleEndian()){
ByteSwap(&in,2);
}
@ -74,7 +74,7 @@ inline uint32_t hostToLittle(uint32_t in){
return OSSwapHostToLittleInt32(in);
#elif __linux__
return htole32(in);
#elif __WIN32
#elif _WIN32
if(!isLittleEndian()){
ByteSwap(&in,4);
}
@ -87,7 +87,7 @@ inline uint64_t hostToLittle(uint64_t in){
return OSSwapHostToLittleInt64(in);
#elif __linux__
return htole64(in);
#elif __WIN32
#elif _WIN32
if(!isLittleEndian()){
ByteSwap(&in,8);
}
@ -103,7 +103,7 @@ std::memcpy(&tmp,&in,2);
tmp = OSSwapHostToLittleInt16(tmp);
#elif __linux__
tmp = htole16(tmp);
#elif __WIN32
#elif _WIN32
if(!isLittleEndian()){
ByteSwap(&tmp,2);
}
@ -121,7 +121,7 @@ std::memcpy(&tmp,&in,4);
tmp = OSSwapHostToLittleInt32(tmp);
#elif __linux__
tmp = htole32(tmp);
#elif __WIN32
#elif _WIN32
if(!isLittleEndian()){
ByteSwap(&tmp,4);
}
@ -139,7 +139,7 @@ std::memcpy(&tmp,&in,8);
tmp = OSSwapHostToLittleInt64(tmp);
#elif __linux__
tmp = htole64(tmp);
#elif __WIN32
#elif _WIN32
if(!isLittleEndian()){
ByteSwap(&tmp,8);
}
@ -155,7 +155,7 @@ inline uint16_t littleToHost(uint16_t in){
return OSSwapLittleToHostInt16(in);
#elif __linux__
return le16toh(in);
#elif __WIN32
#elif _WIN32
if(!isLittleEndian()){
ByteSwap(&in,2);
}
@ -168,7 +168,7 @@ inline uint32_t littleToHost(uint32_t in){
return OSSwapLittleToHostInt32(in);
#elif __linux__
return le32toh(in);
#elif __WIN32
#elif _WIN32
if(!isLittleEndian()){
ByteSwap(&in,4);
}
@ -181,7 +181,7 @@ inline uint64_t littleToHost(uint64_t in){
return OSSwapLittleToHostInt64(in);
#elif __linux__
return le64toh(in);
#elif __WIN32
#elif _WIN32
if(!isLittleEndian()){
ByteSwap(&in,8);
}
@ -196,7 +196,7 @@ std::memcpy(&tmp,&in,2);
tmp = OSSwapLittleToHostInt16(tmp);
#elif __linux__
tmp = le16toh(tmp);
#elif __WIN32
#elif _WIN32
if(!isLittleEndian()){
ByteSwap(&tmp,2);
}
@ -212,7 +212,7 @@ std::memcpy(&tmp,&in,4);
tmp = OSSwapLittleToHostInt32(tmp);
#elif __linux__
tmp = le32toh(tmp);
#elif __WIN32
#elif _WIN32
if(!isLittleEndian()){
ByteSwap(&tmp,4);
}
@ -228,7 +228,7 @@ std::memcpy(&tmp,&in,8);
tmp = OSSwapLittleToHostInt64(tmp);
#elif __linux__
tmp = le64toh(tmp);
#elif __WIN32
#elif _WIN32
if(!isLittleEndian()){
ByteSwap(&tmp,8);
}

View File

@ -38,7 +38,7 @@ inline void cpu_relax() {
// TODO use <boost/fiber/detail/cpu_relax.hpp> when available (>1.65.0?)
#if defined(__i386) || defined(_M_IX86) || defined(__x86_64__) || \
defined(_M_X64)
#if defined __WIN32
#if defined _WIN32
YieldProcessor();
#else
asm volatile("pause" ::: "memory");