Thread (97 messages) flat view 97 messages, 4 authors, 2014-03-25
STALE4523d

[PATCH BlueZ v0 07/62] shared: Add get_be64()

From: Claudio Takahasi <hidden>
Date: 2014-03-20 14:42:32
Subsystem: the rest · Maintainer: Linus Torvalds

Add helper to avoid possible unaligned memory access when handling
uint64 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 251ea2a..9e4d0c0 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -126,6 +126,11 @@ static inline uint64_t get_le64(const void *ptr)
 	return le64_to_cpu(get_unaligned((const uint64_t *) ptr));
 }
 
+static inline uint64_t get_be64(const void *ptr)
+{
+	return be64_to_cpu(get_unaligned((const uint64_t *) ptr));
+}
+
 static inline void put_le16(uint16_t val, void *dst)
 {
 	put_unaligned(cpu_to_le16(val), (uint16_t *) dst);
-- 
1.8.3.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help