Browse Source

Fix building when byteswap.h is not defined

Linking failed in Visual Studio due to unresolved bswap_16().
Tomasz Mon 9 years ago
parent
commit
b14442142b
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/modbus-data.c

+ 2 - 2
src/modbus-data.c

@@ -37,10 +37,9 @@
 #endif
 #if defined(_MSC_VER) && (_MSC_VER >= 1400)
 # define bswap_32 _byteswap_ulong
+# define bswap_16 _byteswap_ushort
 #endif
 
-#if !defined(bswap_32)
-
 #if !defined(bswap_16)
 #   warning "Fallback on C functions for bswap_16"
 static inline uint16_t bswap_16(uint16_t x)
@@ -49,6 +48,7 @@ static inline uint16_t bswap_16(uint16_t x)
 }
 #endif
 
+#if !defined(bswap_32)
 #   warning "Fallback on C functions for bswap_32"
 static inline uint32_t bswap_32(uint32_t x)
 {