summaryrefslogtreecommitdiff
path: root/include/bswap.h
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2018-12-28 13:02:37 +0100
committerAndrej Shadura <andrewsh@debian.org>2018-12-28 13:58:40 +0100
commit5c20c7932a35cb792aad928702cc34ebdfcb0f40 (patch)
tree4213bdcc4fbeff3aefa42cab1233370302c2095c /include/bswap.h
parent6779fa7c477d1639d3e76f206dbc434a7503e091 (diff)
parentf97eb8990990b7938aecad3f06883f682750a125 (diff)
udftools (2.1-1) unstable; urgency=medium * New upstream release (Closes: #916006) * Update Standards-Version to 4.3.0 * Update to debhelper 11 * Update copyright and signing-key.asc
Diffstat (limited to 'include/bswap.h')
-rw-r--r--include/bswap.h28
1 files changed, 5 insertions, 23 deletions
diff --git a/include/bswap.h b/include/bswap.h
index 00627fa..8cfc7ff 100644
--- a/include/bswap.h
+++ b/include/bswap.h
@@ -1,7 +1,7 @@
/*
* bswap.h
*
- * Copyright (c) 2001-2002 Ben Fennema <bfennema@falcon.csc.calpoly.edu>
+ * Copyright (c) 2001-2002 Ben Fennema
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -25,23 +25,9 @@
#include "config.h"
-#include <inttypes.h>
+#include <stdint.h>
#include <sys/types.h>
-#ifdef HAVE_SYS_ISA_DEFS_H
-#define __LITTLE_ENDIAN 1234
-#define __BIG_ENDIAN 4321
-#define __PDP_ENDIAN 3412
-
-#ifdef _LITTLE_ENDIAN
-#define __BYTE_ORDER __LITTLE_ENDIAN
-#endif
-
-#ifdef _BIG_ENDIAN
-#define __BYTE_ORDER __BIG_ENDIAN
-#endif
-#endif
-
#define constant_swab16(x) \
((uint16_t)((((uint16_t)(x) & 0x00FFU) << 8) | \
(((uint16_t)(x) & 0xFF00U) >> 8)))
@@ -135,11 +121,7 @@ static inline uint64_t swab64p(uint64_t *x)
((*(uint64_t *)(x) & 0xFF00000000000000ULL) >> 56)));
}
-#if __BYTE_ORDER == 0
-
-#error "__BYTE_ORDER must be defined"
-
-#elif __BYTE_ORDER == __BIG_ENDIAN
+#ifdef WORDS_BIGENDIAN
#define le16_to_cpu(x) (__builtin_constant_p(x) ? \
constant_swab16(x) : \
@@ -190,7 +172,7 @@ static inline uint64_t swab64p(uint64_t *x)
#define constant_be32_to_cpup(x) (*(uint32_t *)(x))
#define constant_be64_to_cpup(x) (*(uint64_t *)(x))
-#else /* __BYTE_ORDER == __LITTLE_ENDIAN */
+#else /* WORDS_BIGENDIAN */
#define le16_to_cpu(x) ((uint16_t)(x))
#define le32_to_cpu(x) ((uint32_t)(x))
@@ -241,7 +223,7 @@ static inline uint64_t swab64p(uint64_t *x)
#define constant_be32_to_cpup(x) constant_swab32p((x))
#define constant_be64_to_cpup(x) constant_swab64p((x))
-#endif /* __BYTE_ORDER == 0 */
+#endif /* WORDS_BIGENDIAN */
#define cpu_to_le16(x) le16_to_cpu((x))
#define cpu_to_le32(x) le32_to_cpu((x))