Selaa lähdekoodia

Avoid overriding of bswap_32 because bswap_16 is undefined

Stéphane Raimbault 12 vuotta sitten
vanhempi
commit
55c276e8fe
1 muutettua tiedostoa jossa 6 lisäystä ja 2 poistoa
  1. 6 2
      src/modbus-data.c

+ 6 - 2
src/modbus-data.c

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