summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fdisk/fdisksgilabel.c13
-rw-r--r--fdisk/fdisksgilabel.h10
2 files changed, 6 insertions, 17 deletions
diff --git a/fdisk/fdisksgilabel.c b/fdisk/fdisksgilabel.c
index 9f87751d..fb2091da 100644
--- a/fdisk/fdisksgilabel.c
+++ b/fdisk/fdisksgilabel.c
@@ -99,19 +99,6 @@ struct systypes sgi_sys_types[] = {
{0, NULL }
};
-static inline unsigned short
-__swap16(unsigned short x) {
- return (((uint16_t)(x) & 0xFF) << 8) | (((uint16_t)(x) & 0xFF00) >> 8);
-}
-
-static inline uint32_t
-__swap32(uint32_t x) {
- return (((x & 0xFF) << 24) |
- ((x & 0xFF00) << 8) |
- ((x & 0xFF0000) >> 8) |
- ((x & 0xFF000000) >> 24));
-}
-
static int
sgi_get_nsect(void) {
return SSWAP16(sgilabel->devparam.nsect);
diff --git a/fdisk/fdisksgilabel.h b/fdisk/fdisksgilabel.h
index a4704e4d..1445fa94 100644
--- a/fdisk/fdisksgilabel.h
+++ b/fdisk/fdisksgilabel.h
@@ -2,6 +2,9 @@
#define FDISK_SGI_LABEL_H
#include <stdint.h>
+
+#include "bitops.h"
+
/*
* Copyright (C) Andreas Neuper, Sep 1998.
* This file may be modified and redistributed under
@@ -98,10 +101,9 @@ typedef struct {
#define SGI_LABEL_MAGIC_SWAPPED 0x41a9e50b
#define SGI_INFO_MAGIC 0x00072959
#define SGI_INFO_MAGIC_SWAPPED 0x59290700
-#define SSWAP16(x) (other_endian ? __swap16(x) \
- : (uint16_t)(x))
-#define SSWAP32(x) (other_endian ? __swap32(x) \
- : (uint32_t)(x))
+
+#define SSWAP16(x) (other_endian ? swab16(x) : (uint16_t)(x))
+#define SSWAP32(x) (other_endian ? swab32(x) : (uint32_t)(x))
/* fdisk.c */
#define sgilabel ((sgi_partition *)MBRbuffer)