OSDN Git Service
(root)
/
android-x86
/
external-bluetooth-bluez.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8392d24
)
shared: Add get_le16()
author
Claudio Takahasi
<claudio.takahasi@openbossa.org>
Thu, 20 Mar 2014 14:42:27 +0000
(11:42 -0300)
committer
Johan Hedberg
<johan.hedberg@intel.com>
Fri, 21 Mar 2014 08:36:02 +0000
(10:36 +0200)
Add helper to avoid possible unaligned memory access when handling
uint16 value using little-endian representation.
src/shared/util.h
patch
|
blob
|
history
diff --git
a/src/shared/util.h
b/src/shared/util.h
index
a129272
..
ef845ae
100644
(file)
--- a/
src/shared/util.h
+++ b/
src/shared/util.h
@@
-101,6
+101,11
@@
static inline void bswap_128(const void *src, void *dst)
d[15 - i] = s[i];
}
+static inline uint16_t get_le16(const void *ptr)
+{
+ return le16_to_cpu(get_unaligned((const uint16_t *) ptr));
+}
+
static inline void put_le16(uint16_t val, void *dst)
{
put_unaligned(cpu_to_le16(val), (uint16_t *) dst);