From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [PATCH mini-os enhancements for vtpm 3/8] add endian support to mini-os
Date: Tue, 18 Sep 2012 00:12:09 +0200 [thread overview]
Message-ID: <20120917221209.GH5110@type.youpi.perso.aquilenet.fr> (raw)
In-Reply-To: <50579CB7.1010707@jhuapl.edu>
Matthew Fioravante, le Mon 17 Sep 2012 17:57:11 -0400, a écrit :
> diff --git a/extras/mini-os/include/byteorder.h
> b/extras/mini-os/include/byteorder.h
> --- /dev/null
> +++ b/extras/mini-os/include/byteorder.h
Ok.
> -static inline uint16_t bswap_16(uint16_t x)
> -{
> - return
> - ((((x) & 0xff00) >> 8) | (((x) & 0xff) << 8));
> -}
> -
> +#define bswap_16(x) ((uint16_t)( \
> + (((uint16_t)(x) & (uint16_t)0x00ffU) << 8)
> | \
> + (((uint16_t)(x) & (uint16_t)0xff00U) >> 8)))
Why replacing the inline with a macro? AIUI, inlines provide the same
efficiency while providing some minimal type checking (and safety
against things like bswap_16(x++).
> diff --git a/extras/mini-os/include/endian.h
> diff --git a/extras/mini-os/include/ia64/arch_endian.h
> diff --git a/extras/mini-os/include/ia64/arch_wordsize.h
> diff --git a/extras/mini-os/include/x86/arch_endian.h
> diff --git a/extras/mini-os/include/x86/x86_32/arch_wordsize.h
> diff --git a/extras/mini-os/include/x86/x86_64/arch_wordsize.h
Ok.
Samuel
next prev parent reply other threads:[~2012-09-17 22:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-17 21:57 [PATCH mini-os enhancements for vtpm 3/8] add endian support to mini-os Matthew Fioravante
2012-09-17 22:12 ` Samuel Thibault [this message]
2012-09-18 17:45 ` Matthew Fioravante
2012-09-18 17:52 ` Samuel Thibault
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=20120917221209.GH5110@type.youpi.perso.aquilenet.fr \
--to=samuel.thibault@ens-lyon.org \
--cc=matthew.fioravante@jhuapl.edu \
--cc=xen-devel@lists.xensource.com \
/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).