From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: qemu-devel@nongnu.org, agraf@suse.de,
Blue Swirl <blauwirbel@gmail.com>,
Isaku Yamahata <yamahata@valinux.co.jp>,
paul@codesourcery.com, Aurelien Jarno <aurelien@aurel32.net>
Subject: [Qemu-devel] [PATCHv2 1/3] bwap: add qemu_bswap helper
Date: Mon, 18 Jan 2010 12:56:30 +0200 [thread overview]
Message-ID: <20100118105630.GB8277@redhat.com> (raw)
In-Reply-To: <cover.1263811970.git.mst@redhat.com>
add helper that can swap values of 4, 2, 1 bytes
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
bswap.h | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/bswap.h b/bswap.h
index 4558704..aace9b7 100644
--- 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 */
--
1.6.6.144.g5c3af
next parent reply other threads:[~2010-01-18 11:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1263811970.git.mst@redhat.com>
2010-01-18 10:56 ` Michael S. Tsirkin [this message]
2010-01-18 10:56 ` [Qemu-devel] [PATCHv2 2/3] rwhandler: simplified way to register for mem/io Michael S. Tsirkin
2010-01-18 10:56 ` [Qemu-devel] [PATCHv2 3/3] pci_host: rewrite using rwhandler Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100118105630.GB8277@redhat.com \
--to=mst@redhat.com \
--cc=agraf@suse.de \
--cc=aurelien@aurel32.net \
--cc=blauwirbel@gmail.com \
--cc=paul@codesourcery.com \
--cc=qemu-devel@nongnu.org \
--cc=yamahata@valinux.co.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).