|
Packit Service |
360c39 |
#ifndef __LINUX_ENDIAN_DOT_H__
|
|
Packit Service |
360c39 |
#define __LINUX_ENDIAN_DOT_H__
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
#include <endian.h>
|
|
Packit Service |
360c39 |
#include <byteswap.h>
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
/* I'm not sure which versions of alpha glibc/gcc are broken,
|
|
Packit Service |
360c39 |
so fix all of them. */
|
|
Packit Service |
360c39 |
#ifdef __alpha__
|
|
Packit Service |
360c39 |
#undef bswap_64
|
|
Packit Service |
360c39 |
static __inline__ unsigned long bswap_64(unsigned long x)
|
|
Packit Service |
360c39 |
{
|
|
Packit Service |
360c39 |
unsigned int h = x >> 32;
|
|
Packit Service |
360c39 |
unsigned int l = x;
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
h = bswap_32(h);
|
|
Packit Service |
360c39 |
l = bswap_32(l);
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
return ((unsigned long)l << 32) | h;
|
|
Packit Service |
360c39 |
}
|
|
Packit Service |
360c39 |
#endif /* __alpha__ */
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
#if __BYTE_ORDER == __BIG_ENDIAN
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
#define be16_to_cpu(x) (x)
|
|
Packit Service |
360c39 |
#define be32_to_cpu(x) (x)
|
|
Packit Service |
360c39 |
#define be64_to_cpu(x) (x)
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
#define cpu_to_be16(x) (x)
|
|
Packit Service |
360c39 |
#define cpu_to_be32(x) (x)
|
|
Packit Service |
360c39 |
#define cpu_to_be64(x) (x)
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
#define le16_to_cpu(x) (bswap_16((x)))
|
|
Packit Service |
360c39 |
#define le32_to_cpu(x) (bswap_32((x)))
|
|
Packit Service |
360c39 |
#define le64_to_cpu(x) (bswap_64((x)))
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
#define cpu_to_le16(x) (bswap_16((x)))
|
|
Packit Service |
360c39 |
#define cpu_to_le32(x) (bswap_32((x)))
|
|
Packit Service |
360c39 |
#define cpu_to_le64(x) (bswap_64((x)))
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
#endif /* __BYTE_ORDER == __BIG_ENDIAN */
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
#define be16_to_cpu(x) (bswap_16((x)))
|
|
Packit Service |
360c39 |
#define be32_to_cpu(x) (bswap_32((x)))
|
|
Packit Service |
360c39 |
#define be64_to_cpu(x) (bswap_64((x)))
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
#define cpu_to_be16(x) (bswap_16((x)))
|
|
Packit Service |
360c39 |
#define cpu_to_be32(x) (bswap_32((x)))
|
|
Packit Service |
360c39 |
#define cpu_to_be64(x) (bswap_64((x)))
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
#define le16_to_cpu(x) (x)
|
|
Packit Service |
360c39 |
#define le32_to_cpu(x) (x)
|
|
Packit Service |
360c39 |
#define le64_to_cpu(x) (x)
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
#define cpu_to_le16(x) (x)
|
|
Packit Service |
360c39 |
#define cpu_to_le32(x) (x)
|
|
Packit Service |
360c39 |
#define cpu_to_le64(x) (x)
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
#endif /* __BYTE_ORDER == __LITTLE_ENDIAN */
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
#endif /* __LINUX_ENDIAN_DOT_H__ */
|