More endianness for platforms
[fio.git] / os / os.h
diff --git a/os/os.h b/os/os.h
index 2eb38e87afda20dae2b52ebd65d1dfc146247e23..33baf73264e6e7b47b5213fd12ae3bc57f52a2b9 100644 (file)
--- a/os/os.h
+++ b/os/os.h
@@ -115,6 +115,30 @@ typedef unsigned long os_cpu_mask_t;
 #define FIO_MAX_JOBS           2048
 #endif
 
 #define FIO_MAX_JOBS           2048
 #endif
 
+#if 0
+static inline uint16 fio_swap16(uint16_t val)
+{
+       return (val << 8) | (val >> 8);
+}
+
+static inline uint32_t bswap_32(uint32_t val)
+{
+       val = ((val & 0xff00ff00UL) >> 8) | ((val & 0x00ff00ffUL) << 8);
+
+       return (val >> 16) | (val << 16);
+}
+
+static inline uint64_t bswap_64(uint64_t x)
+{
+       val = ((val & 0xff00ff00ff00ff00ULL) >> 8) |
+             ((val & 0x00ff00ff00ff00ffULL) << 8);
+       val = ((val & 0xffff0000ffff0000ULL) >> 16) |
+             ((val & 0x0000ffff0000ffffULL) << 16);
+
+       return (val >> 32) | (val << 32);
+}
+#endif
+
 #ifndef FIO_HAVE_BLKTRACE
 static inline int is_blktrace(const char *fname)
 {
 #ifndef FIO_HAVE_BLKTRACE
 static inline int is_blktrace(const char *fname)
 {