From 9c6c6a432a0cbe2832bc97a7eeddfb61f6b8b856 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Thu, 30 Jun 2016 11:32:12 +0200 Subject: [PATCH] IIOD: Define __bswap_constant_16/32 if not already defined The musl C library does not define these macros. Signed-off-by: Paul Cercueil --- iiod/iiod.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/iiod/iiod.c b/iiod/iiod.c index 4aca5979d..3f20f5335 100644 --- a/iiod/iiod.c +++ b/iiod/iiod.c @@ -47,6 +47,17 @@ #define IIOD_PORT 30431 +#ifndef __bswap_constant_16 +#define __bswap_constant_16(x) \ + ((unsigned short int) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))) +#endif + +#ifndef __bswap_constant_32 +#define __bswap_constant_32(x) \ + ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \ + (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) +#endif + struct client_data { int fd; bool debug;