projects
/
qemu.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
186993e
)
bwap: add qemu_bswap helper
author
Michael S. Tsirkin
<mst@redhat.com>
Thu, 14 Jan 2010 13:58:52 +0000
(15:58 +0200)
committer
Michael S. Tsirkin
<mst@redhat.com>
Sun, 14 Feb 2010 14:10:53 +0000
(16:10 +0200)
add helper that can swap values of 4, 2, 1 bytes
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
bswap.h
patch
|
blob
|
history
diff --git
a/bswap.h
b/bswap.h
index 45587042907ed4bc7160474a121d11210c979e67..aace9b76e963cddf9c4224e82d7e4caa31b48c45 100644
(file)
--- a/
bswap.h
+++ b/
bswap.h
@@
-214,4
+214,10
@@
static inline void cpu_to_be32wu(uint32_t *p, uint32_t v)
#undef le_bswaps
#undef be_bswaps
+/* len must be one of 1, 2, 4 */
+static inline uint32_t qemu_bswap_len(uint32_t value, int len)
+{
+ return bswap32(value) >> (32 - 8 * len);
+}
+
#endif /* BSWAP_H */