From 9eca9d0dd26eea526ea45647fd3c3085f008838b Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 17 Dec 2007 13:26:38 +0100 Subject: [PATCH] fdisk: use swab macros from bitops.h Signed-off-by: Karel Zak --- fdisk/gpt.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/fdisk/gpt.c b/fdisk/gpt.c index be7c0175..2c96b026 100644 --- a/fdisk/gpt.c +++ b/fdisk/gpt.c @@ -39,25 +39,7 @@ #include "gpt.h" #include "blkdev.h" - -#define _GET_BYTE(x, n) ( ((x) >> (8 * (n))) & 0xff ) - -#define _PED_SWAP64(x) ( (_GET_BYTE(x, 0) << 56) \ - + (_GET_BYTE(x, 1) << 48) \ - + (_GET_BYTE(x, 2) << 40) \ - + (_GET_BYTE(x, 3) << 32) \ - + (_GET_BYTE(x, 4) << 24) \ - + (_GET_BYTE(x, 5) << 16) \ - + (_GET_BYTE(x, 6) << 8) \ - + (_GET_BYTE(x, 7) << 0) ) - -#define PED_SWAP64(x) ((uint64_t) _PED_SWAP64( (uint64_t) (x) )) - -#if __BYTE_ORDER == __LITTLE_ENDIAN -# define CPU_TO_LE64(x) (x) -#else -# define CPU_TO_LE64(x) PED_SWAP64(x) -#endif +#include "bitops.h" #define GPT_HEADER_SIGNATURE 0x5452415020494645LL #define GPT_PRIMARY_PARTITION_TABLE_LBA 1 @@ -211,7 +193,7 @@ gpt_check_signature(int fd, uint64_t lba) if ((gpt = alloc_read_gpt_header(fd, lba))) { - if (gpt->Signature == CPU_TO_LE64(GPT_HEADER_SIGNATURE)) + if (gpt->Signature == cpu_to_le64(GPT_HEADER_SIGNATURE)) res = 1; free(gpt); } -- 2.39.5