From: Theodore Ts'o Date: Thu, 29 Sep 2011 00:27:03 +0000 (-0400) Subject: libext2fs: use ext2fs byte swap functions for portability X-Git-Tag: v1.42-WIP-1001~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a378bd5a5a80656ad1782ee80fa301a5ecb10ecb;p=thirdparty%2Fe2fsprogs.git libext2fs: use ext2fs byte swap functions for portability The functions htole32(), le32toh(), be32toh(), htobe32() aren't defined in all environments. Use the ext2fs byte swap functions for portability. Signed-off-by: "Theodore Ts'o" --- diff --git a/lib/ext2fs/crc32c_defs.h b/lib/ext2fs/crc32c_defs.h index 17529706d..ced4f67a2 100644 --- a/lib/ext2fs/crc32c_defs.h +++ b/lib/ext2fs/crc32c_defs.h @@ -42,18 +42,19 @@ (((uint32_t)(x) & (uint32_t)0xff000000UL) >> 24))) +#include "ext2fs.h" #ifdef WORDS_BIGENDIAN #define __constant_cpu_to_le32(x) ___constant_swab32((x)) #define __constant_cpu_to_be32(x) (x) #define __be32_to_cpu(x) (x) #define __cpu_to_be32(x) (x) -#define __cpu_to_le32(x) (htole32((x))) -#define __le32_to_cpu(x) (le32toh((x))) +#define __cpu_to_le32(x) (ext2fs_cpu_to_le32((x))) +#define __le32_to_cpu(x) (ext2fs_le32_to_cpu((x))) #else #define __constant_cpu_to_le32(x) (x) #define __constant_cpu_to_be32(x) ___constant_swab32((x)) -#define __be32_to_cpu(x) (be32toh((x))) -#define __cpu_to_be32(x) (htobe32((x))) +#define __be32_to_cpu(x) (ext2fs_be32_to_cpu((x))) +#define __cpu_to_be32(x) (ext2fs_cpu_to_be32((x))) #define __cpu_to_le32(x) (x) #define __le32_to_cpu(x) (x) #endif