diff options
author | Richard Jones <rjones@redhat.com> | 2009-10-29 17:54:48 +0000 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2009-10-29 17:54:48 +0000 |
commit | a4e27cdf4d3b831792dd20d796dc98a5bc684290 (patch) | |
tree | c7fe946a3fd8ae839056583387dc73404caa4a10 /hivex/hivex.c | |
parent | e02f42cb1d7f60c9d2f020d7d8c1b5316fb61310 (diff) | |
download | libguestfs-a4e27cdf4d3b831792dd20d796dc98a5bc684290.tar.gz libguestfs-a4e27cdf4d3b831792dd20d796dc98a5bc684290.tar.xz libguestfs-a4e27cdf4d3b831792dd20d796dc98a5bc684290.zip |
RHEL 5: Detect endianness functions and supply them.
Diffstat (limited to 'hivex/hivex.c')
-rw-r--r-- | hivex/hivex.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/hivex/hivex.c b/hivex/hivex.c index 16be753b..85d6c7be 100644 --- a/hivex/hivex.c +++ b/hivex/hivex.c @@ -18,11 +18,12 @@ * See file LICENSE for the full license. */ +#include <config.h> + #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h> -#include <endian.h> #include <fcntl.h> #include <unistd.h> #include <errno.h> @@ -30,6 +31,34 @@ #include <sys/mman.h> #include <sys/stat.h> #include <assert.h> +#ifdef HAVE_ENDIAN_H +#include <endian.h> +#endif +#ifdef HAVE_BYTESWAP_H +#include <byteswap.h> +#endif + +#if __BYTE_ORDER == __LITTLE_ENDIAN +#ifndef be32toh +#define be32toh(x) __bswap_32 (x) +#endif +#ifndef be64toh +#define be64toh(x) __bswap_64 (x) +#endif +#ifndef le32toh +#define le32toh(x) (x) +#endif +#else +#ifndef be32toh +#define be32toh(x) (x) +#endif +#ifndef be64toh +#define be64toh(x) (x) +#endif +#ifndef le32toh +#define le32toh(x) __bswap_32 (x) +#endif +#endif #include "hivex.h" |