#define BITOPS_H
#include <stdint.h>
-#include <endian.h>
/*
* Bit map related macros. Usually provided by libc.
# define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
#endif
-#if !defined __BYTE_ORDER || !(__BYTE_ORDER == __LITTLE_ENDIAN) && !(__BYTE_ORDER == __BIG_ENDIAN)
-#error missing __BYTE_ORDER
-#endif
-
/*
* Byte swab macros (based on linux/byteorder/swab.h)
*/
(uint64_t)(((uint64_t)(x) & (uint64_t)0xff00000000000000ULL) >> 56) ))
-#if (__BYTE_ORDER == __BIG_ENDIAN)
+#ifdef WORDS_BIGENDIAN
#define cpu_to_le16(x) swab16(x)
#define cpu_to_le32(x) swab32(x)
#define be32_to_cpu(x) (x)
#define be64_to_cpu(x) (x)
-#else /* __BYTE_ORDER != __BIG_ENDIAN */
+#else /* !WORDS_BIGENDIAN */
#define cpu_to_le16(x) (x)
#define cpu_to_le32(x) (x)
#define be32_to_cpu(x) swab32(x)
#define be64_to_cpu(x) swab64(x)
-#endif /* __BYTE_ORDER */
+#endif /* WORDS_BIGENDIAN */
#endif /* BITOPS_H */
* needed on buffers full of bytes, and then call MD5Final, which
* will fill a supplied 16-byte array with the digest.
*/
-#include <endian.h>
#include <string.h> /* for memcpy() */
#include "md5.h"
-#if !defined __BYTE_ORDER || !(__BYTE_ORDER == __LITTLE_ENDIAN) && !(__BYTE_ORDER == __BIG_ENDIAN)
-#error missing __BYTE_ORDER
-#endif
-
-#if (__BYTE_ORDER == __LITTLE_ENDIAN)
+#if !defined(WORDS_BIGENDIAN)
#define byteReverse(buf, len) /* Nothing */
#else
void byteReverse(unsigned char *buf, unsigned longs);
*(p - 2) = '\0';
print_s(_("CPU op-mode(s):"), buf);
}
-#ifdef __BYTE_ORDER
-#if (__BYTE_ORDER == __LITTLE_ENDIAN)
+#if !defined(WORDS_BIGENDIAN)
print_s(_("Byte Order:"), "Little Endian");
#else
print_s(_("Byte Order:"), "Big Endian");
-#endif
#endif
print_n(_("CPU(s):"), desc->ncpus);
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <endian.h>
#include <limits.h>
-#if !defined __BYTE_ORDER || !(__BYTE_ORDER == __LITTLE_ENDIAN) && !(__BYTE_ORDER == __BIG_ENDIAN)
-#error missing __BYTE_ORDER
-#endif
-
typedef struct {
const char *name;
int (*fnc)(void);
int
hlp_endianness(void)
{
-#if (__BYTE_ORDER == __LITTLE_ENDIAN)
+#if !defined(WORDS_BIGENDIAN)
printf("LE\n");
#else
printf("BE\n");