Commit 7ef3fa5f00ae99f2299d16fb621d3b1ceff926af
1 parent
cb4d3ea6
Minor coding conventions on defines
Showing
1 changed file
with
15 additions
and
12 deletions
src/modbus-data.c
| ... | ... | @@ -5,18 +5,20 @@ |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | #include <stdlib.h> |
| 8 | + | |
| 8 | 9 | #ifndef _MSC_VER |
| 9 | -#include <stdint.h> | |
| 10 | +# include <stdint.h> | |
| 10 | 11 | #else |
| 11 | -#include "stdint.h" | |
| 12 | +# include "stdint.h" | |
| 12 | 13 | #endif |
| 14 | + | |
| 13 | 15 | #include <string.h> |
| 14 | 16 | #include <assert.h> |
| 15 | 17 | |
| 16 | 18 | #if defined(_WIN32) |
| 17 | -# include <winsock2.h> | |
| 19 | +# include <winsock2.h> | |
| 18 | 20 | #else |
| 19 | -# include <arpa/inet.h> | |
| 21 | +# include <arpa/inet.h> | |
| 20 | 22 | #endif |
| 21 | 23 | |
| 22 | 24 | #include <config.h> |
| ... | ... | @@ -28,10 +30,10 @@ |
| 28 | 30 | #endif |
| 29 | 31 | |
| 30 | 32 | #if defined(__APPLE__) |
| 31 | - #include <libkern/OSByteOrder.h> | |
| 32 | - #define bswap_16 OSSwapInt16 | |
| 33 | - #define bswap_32 OSSwapInt32 | |
| 34 | - #define bswap_64 OSSwapInt64 | |
| 33 | +# include <libkern/OSByteOrder.h> | |
| 34 | +# define bswap_16 OSSwapInt16 | |
| 35 | +# define bswap_32 OSSwapInt32 | |
| 36 | +# define bswap_64 OSSwapInt64 | |
| 35 | 37 | #endif |
| 36 | 38 | |
| 37 | 39 | #if defined(__GNUC__) |
| ... | ... | @@ -42,14 +44,15 @@ |
| 42 | 44 | # define bswap_32 __builtin_bswap32 |
| 43 | 45 | # endif |
| 44 | 46 | #endif |
| 47 | + | |
| 45 | 48 | #if defined(_MSC_VER) && (_MSC_VER >= 1400) |
| 46 | -# define bswap_32 _byteswap_ulong | |
| 47 | -# define bswap_16 _byteswap_ushort | |
| 49 | +# define bswap_32 _byteswap_ulong | |
| 50 | +# define bswap_16 _byteswap_ushort | |
| 48 | 51 | #endif |
| 49 | 52 | |
| 50 | 53 | #if !defined(__CYGWIN__) |
| 51 | 54 | #if !defined(bswap_16) |
| 52 | -# warning "Fallback on C functions for bswap_16" | |
| 55 | +# warning "Fallback on C functions for bswap_16" | |
| 53 | 56 | static inline uint16_t bswap_16(uint16_t x) |
| 54 | 57 | { |
| 55 | 58 | return (x >> 8) | (x << 8); |
| ... | ... | @@ -58,7 +61,7 @@ static inline uint16_t bswap_16(uint16_t x) |
| 58 | 61 | #endif |
| 59 | 62 | |
| 60 | 63 | #if !defined(bswap_32) |
| 61 | -# warning "Fallback on C functions for bswap_32" | |
| 64 | +# warning "Fallback on C functions for bswap_32" | |
| 62 | 65 | static inline uint32_t bswap_32(uint32_t x) |
| 63 | 66 | { |
| 64 | 67 | return (bswap_16(x & 0xffff) << 16) | (bswap_16(x >> 16)); | ... | ... |