Browse Source

Avoid overriding of bswap_32 because bswap_16 is undefined

Stéphane Raimbault 12 years ago
parent
commit
55c276e8fe
1 changed files with 6 additions and 2 deletions
  1. 6 2
      src/modbus-data.c

+ 6 - 2
src/modbus-data.c

@@ -40,13 +40,17 @@
 #  endif
 #  endif
 #endif
 #endif
 
 
-#if !defined (bswap_16) || !defined (bswap_32)
-#   warning "Fallback on C functions for bswap_32"
+#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)
 static inline uint16_t bswap_16(uint16_t x)
 {
 {
     return (x >> 8) | (x << 8);
     return (x >> 8) | (x << 8);
 }
 }
+#endif
 
 
+#   warning "Fallback on C functions for bswap_32"
 static inline uint32_t bswap_32(uint32_t x)
 static inline uint32_t bswap_32(uint32_t x)
 {
 {
     return (bswap_16(x & 0xffff) << 16) | (bswap_16(x >> 16));
     return (bswap_16(x & 0xffff) << 16) | (bswap_16(x >> 16));