Commit 55c276e8fe49cbaf2f5b8ccec5af3e4017e784fe

Authored by Stéphane Raimbault
1 parent 4d76d215

Avoid overriding of bswap_32 because bswap_16 is undefined

Showing 1 changed file with 6 additions and 2 deletions
src/modbus-data.c
@@ -40,13 +40,17 @@ @@ -40,13 +40,17 @@
40 # endif 40 # endif
41 #endif 41 #endif
42 42
43 -#if !defined (bswap_16) || !defined (bswap_32)  
44 -# warning "Fallback on C functions for bswap_32" 43 +#if !defined(bswap_32)
  44 +
  45 +#if !defined(bswap_16)
  46 +# warning "Fallback on C functions for bswap_16"
45 static inline uint16_t bswap_16(uint16_t x) 47 static inline uint16_t bswap_16(uint16_t x)
46 { 48 {
47 return (x >> 8) | (x << 8); 49 return (x >> 8) | (x << 8);
48 } 50 }
  51 +#endif
49 52
  53 +# warning "Fallback on C functions for bswap_32"
50 static inline uint32_t bswap_32(uint32_t x) 54 static inline uint32_t bswap_32(uint32_t x)
51 { 55 {
52 return (bswap_16(x & 0xffff) << 16) | (bswap_16(x >> 16)); 56 return (bswap_16(x & 0xffff) << 16) | (bswap_16(x >> 16));