From: Stefan Weil <sw@weilnetz.de>
To: qemu-trivial@nongnu.org
Cc: Stefan Weil <sw@weilnetz.de>, Laszlo Ersek <lersek@redhat.com>,
qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 2/2] bswap: Modify prototypes of st[wl]_{le, be}_p (avoid type conversions)
Date: Wed, 19 Feb 2014 06:11:45 +0100 [thread overview]
Message-ID: <1392786705-9730-3-git-send-email-sw@weilnetz.de> (raw)
In-Reply-To: <1392786705-9730-1-git-send-email-sw@weilnetz.de>
The function use uint16_t or uint32_t values, so show this in the function
prototypes. Non-optimizing compilers will avoid unnecessary type
conversions when generating calls of these inline function.
stq_le_p, stq_be_p already use similar prototypes.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
include/qemu/bswap.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h
index 0cc11a5..0cb7c05 100644
--- a/include/qemu/bswap.h
+++ b/include/qemu/bswap.h
@@ -300,12 +300,12 @@ static inline uint64_t ldq_le_p(const void *ptr)
return le_bswap(ldq_p(ptr), 64);
}
-static inline void stw_le_p(void *ptr, int v)
+static inline void stw_le_p(void *ptr, uint16_t v)
{
stw_p(ptr, le_bswap(v, 16));
}
-static inline void stl_le_p(void *ptr, int v)
+static inline void stl_le_p(void *ptr, uint32_t v)
{
stl_p(ptr, le_bswap(v, 32));
}
@@ -365,12 +365,12 @@ static inline uint64_t ldq_be_p(const void *ptr)
return be_bswap(ldq_p(ptr), 64);
}
-static inline void stw_be_p(void *ptr, int v)
+static inline void stw_be_p(void *ptr, uint16_t v)
{
stw_p(ptr, be_bswap(v, 16));
}
-static inline void stl_be_p(void *ptr, int v)
+static inline void stl_be_p(void *ptr, uint32_t v)
{
stl_p(ptr, be_bswap(v, 32));
}
--
1.7.10.4
next prev parent reply other threads:[~2014-02-19 5:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-19 5:11 [Qemu-devel] [PATCH 0/2] bswap: Clean prototypes of st* functions Stefan Weil
2014-02-19 5:11 ` [Qemu-devel] [PATCH 1/2] bswap: Modify prototype of stb_p (avoid type conversions) Stefan Weil
2014-02-19 5:11 ` Stefan Weil [this message]
2014-02-19 5:19 ` [Qemu-devel] [PATCH 2/2] bswap: Modify prototypes of st[wl]_{le, be}_p " Stefan Weil
2014-02-19 10:16 ` [Qemu-devel] [PATCH 0/2] bswap: Clean prototypes of st* functions Laszlo Ersek
2014-02-22 12:06 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
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=1392786705-9730-3-git-send-email-sw@weilnetz.de \
--to=sw@weilnetz.de \
--cc=lersek@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/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).