[PATCH BlueZ v0 06/62] shared: Add get_be32()

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

 



Add helper to avoid possible unaligned memory access when handling
uint32 value using big-endian representation.
---
 src/shared/util.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/shared/util.h b/src/shared/util.h
index e315f84..251ea2a 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -116,6 +116,11 @@ static inline uint32_t get_le32(const void *ptr)
 	return le32_to_cpu(get_unaligned((const uint32_t *) ptr));
 }
 
+static inline uint32_t get_be32(const void *ptr)
+{
+	return be32_to_cpu(get_unaligned((const uint32_t *) ptr));
+}
+
 static inline uint64_t get_le64(const void *ptr)
 {
 	return le64_to_cpu(get_unaligned((const uint64_t *) ptr));
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux