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:
0c75268
)
shared: Add put_be16()
author
Claudio Takahasi
<claudio.takahasi@openbossa.org>
Thu, 20 Mar 2014 14:42:33 +0000
(11:42 -0300)
committer
Johan Hedberg
<johan.hedberg@intel.com>
Fri, 21 Mar 2014 08:36:13 +0000
(10:36 +0200)
Add helper to avoid possible unaligned memory access when handling
uint16 value using big-endian representation.
src/shared/util.h
patch
|
blob
|
history
diff --git
a/src/shared/util.h
b/src/shared/util.h
index
9e4d0c0
..
0d0b45f
100644
(file)
--- a/
src/shared/util.h
+++ b/
src/shared/util.h
@@
-136,6
+136,11
@@
static inline void put_le16(uint16_t val, void *dst)
put_unaligned(cpu_to_le16(val), (uint16_t *) dst);
}
+static inline void put_be16(uint16_t val, const void *ptr)
+{
+ put_unaligned(cpu_to_be16(val), (uint16_t *) ptr);
+}
+
static inline void put_le32(uint32_t val, void *dst)
{
put_unaligned(cpu_to_le32(val), (uint32_t *) dst);