Commit 57c3d76fc151fd724821dda7ce725e2ebbd8039d
Committed by
Stéphane Raimbault
1 parent
2689016a
Add bswap macro to compile on OSX
Showing
1 changed file
with
7 additions
and
0 deletions
src/modbus-data.c
| @@ -27,6 +27,13 @@ | @@ -27,6 +27,13 @@ | ||
| 27 | # include <byteswap.h> | 27 | # include <byteswap.h> |
| 28 | #endif | 28 | #endif |
| 29 | 29 | ||
| 30 | +#if defined(__APPLE__) | ||
| 31 | + #include <libkern/OSByteOrder.h> | ||
| 32 | + #define bswap_16 OSSwapInt16 | ||
| 33 | + #define bswap_32 OSSwapInt32 | ||
| 34 | + #define bswap_64 OSSwapInt64 | ||
| 35 | +#endif | ||
| 36 | + | ||
| 30 | #if defined(__GNUC__) | 37 | #if defined(__GNUC__) |
| 31 | # define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__ * 10) | 38 | # define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__ * 10) |
| 32 | # if GCC_VERSION >= 430 | 39 | # if GCC_VERSION >= 430 |