[PATCH v2 4/8] libmultipath: add (get|put)_unaligned_be64

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Martin Wilck <mwilck@xxxxxxxx>
---
 libmultipath/unaligned.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/libmultipath/unaligned.h b/libmultipath/unaligned.h
index 14ec8b23..68c07742 100644
--- a/libmultipath/unaligned.h
+++ b/libmultipath/unaligned.h
@@ -17,6 +17,14 @@ static inline uint32_t get_unaligned_be32(void *ptr)
 	return p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3];
 }
 
+static inline uint64_t get_unaligned_be64(void *ptr)
+{
+	uint32_t low = get_unaligned_be32(ptr + 4);
+	uint64_t high = get_unaligned_be32(ptr);
+
+	return high << 32 | low;
+}
+
 static inline void put_unaligned_be16(uint16_t val, void *ptr)
 {
 	uint8_t *p = ptr;
@@ -35,4 +43,12 @@ static inline void put_unaligned_be32(uint32_t val, void *ptr)
 	p[3] = val;
 }
 
+static inline void put_unaligned_be64(uint64_t val, void *ptr)
+{
+	uint8_t *p = ptr;
+
+	put_unaligned_be32(val >> 32, p);
+	put_unaligned_be32(val, p + 4);
+}
+
 #endif /* _UNALIGNED_H_ */
-- 
2.17.1

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel



[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux