Signed-off-by: Daniel Mack daniel@caiaq.de --- include/i386/arch/endian.h | 11 +++++++++++ include/powerpc/arch/endian.h | 14 ++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/include/i386/arch/endian.h b/include/i386/arch/endian.h index a50ac1f..743787f 100644 --- a/include/i386/arch/endian.h +++ b/include/i386/arch/endian.h @@ -38,4 +38,15 @@ (( (in) & 0xFF0000) >> 8) | (( (in) & 0xFF000000) >> 24))
#define ntohll(in) (((u64) ntohl( (in) & 0xFFFFFFFF) << 32) | ((u64) ntohl( (in) >> 32))) + +#define cpu_to_le16(in) (in) +#define cpu_to_le32(in) (in) +#define cpu_to_be16(in) ntohw(in) +#define cpu_to_be32(in) ntohl(in) + +#define le16_to_cpu(in) (in) +#define le32_to_cpu(in) (in) +#define be16_to_cpu(in) ntohw(in) +#define be32_to_cpu(in) ntohl(in) + #endif diff --git a/include/powerpc/arch/endian.h b/include/powerpc/arch/endian.h index 8ffad70..1cc7c57 100644 --- a/include/powerpc/arch/endian.h +++ b/include/powerpc/arch/endian.h @@ -33,9 +33,19 @@ #include <arch/types.h>
#define ntohw(in) (in) - #define ntohl(in) (in) - #define ntohll(in) (in)
+#define cpu_to_le16(in) ((( (in) & 0xFF) << 8) | (( (in) & 0xFF00) >> 8)) +#define cpu_to_le32(in) ((( (in) & 0xFF) << 24) | (( (in) & 0xFF00) << 8) | \ + (( (in) & 0xFF0000) >> 8) | (( (in) & 0xFF000000) >> 24)) + +#define cpu_to_be16(in) (in) +#define cpu_to_be32(in) (in) + +#define le16_to_cpu(in) cpu_to_le16(in) +#define le32_to_cpu(in) cpu_to_le32(in) +#define be16_to_cpu(in) (in) +#define be32_to_cpu(in) (in) + #endif