From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Lin Liu <lin.liu@citrix.com>
Cc: xen-devel@lists.xenproject.org,
Andrew Cooper <andrew.cooper3@citrix.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Julien Grall <julien@xen.org>,
Bertrand Marquis <bertrand.marquis@arm.com>,
Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
George Dunlap <george.dunlap@citrix.com>,
Jan Beulich <jbeulich@suse.com>, Wei Liu <wl@xen.org>
Subject: Re: [PATCH v4 1/6] xen: implement byteswap
Date: Mon, 23 May 2022 12:07:02 +0200 [thread overview]
Message-ID: <YotcxufG467QSLab@Air-de-Roger> (raw)
In-Reply-To: <89b15afe026a84748ac0d9ca28e8608085454e78.1653295437.git.lin.liu@citrix.com>
On Mon, May 23, 2022 at 05:52:17AM -0400, Lin Liu wrote:
> diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
> index 933aec09a9..ae029afa14 100644
> --- a/xen/include/xen/compiler.h
> +++ b/xen/include/xen/compiler.h
> @@ -185,4 +185,28 @@
> # define CLANG_DISABLE_WARN_GCC_COMPAT_END
> #endif
>
> +#ifndef __has_builtin
> +/*
> + * Backwards compatibility for GCC < 10.
> + * All supported versions of Clang support __has_builtin
> + * */
> +#define __has_builtin(x) GCC_has ## x
> +
> +#define GCC_has__builtin_bswap16 (CONFIG_GCC_VERSION >= 40800)
> +#define GCC_has__builtin_bswap32 (CONFIG_GCC_VERSION >= 40400)
> +#define GCC_has__builtin_bswap64 (CONFIG_GCC_VERSION >= 40400)
> +#endif
> +
> +#ifndef __ORDER_LITTLE_ENDIAN__
> +# define __ORDER_LITTLE_ENDIAN__ 1234
> +#endif
> +
> +#ifndef __ORDER_BIG_ENDIAN__
> +# define __ORDER_BIG_ENDIAN__ 4321
> +#endif
> +
> +/* Indirect macros required for expanded argument pasting. */
> +#define PASTE_(a, b) a ## b
> +#define PASTE(a, b) PASTE_(a, b)
I think it would be better if byteswap.h included lib.h, rather than
moving the PASTE define into compiler.h.
Likewise the __ORDER_{BIG,LITTLE}_ENDIAN__ defines would be better
placed in byteswap.h itself if possible IMO, since it's not strictly
related to the compiler.
Thanks, Roger.
next prev parent reply other threads:[~2022-05-23 10:07 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-23 9:52 [PATCH v4 0/6] Implement byteswap and update references Lin Liu
2022-05-23 9:52 ` [PATCH v4 1/6] xen: implement byteswap Lin Liu
2022-05-23 10:07 ` Roger Pau Monné [this message]
2022-05-23 11:00 ` Jan Beulich
2022-05-23 11:05 ` Jan Beulich
2022-05-23 9:52 ` [PATCH v4 2/6] crypto/vmac: Simplify code with byteswap Lin Liu
2022-05-23 9:52 ` [PATCH v4 3/6] arm64/find_next_bit: Remove ext2_swab() Lin Liu
2022-05-23 10:10 ` Julien Grall
2022-05-23 9:52 ` [PATCH v4 4/6] xen: Switch to byteswap Lin Liu
2022-05-23 10:12 ` Julien Grall
2022-05-23 11:09 ` Jan Beulich
2022-05-23 9:52 ` [PATCH v4 5/6] tools: Use new byteswap helper Lin Liu
2022-05-23 11:10 ` Jan Beulich
2022-05-24 2:13 ` Lin Liu (刘林)
2022-05-24 6:10 ` Jan Beulich
2022-05-24 6:52 ` Lin Liu (刘林)
2022-05-24 6:58 ` Jan Beulich
2022-05-24 7:17 ` Lin Liu (刘林)
2022-05-24 8:52 ` Jan Beulich
2022-05-23 9:52 ` [PATCH v4 6/6] byteorder: Remove byteorder Lin Liu
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=YotcxufG467QSLab@Air-de-Roger \
--to=roger.pau@citrix.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=andrew.cooper3@citrix.com \
--cc=bertrand.marquis@arm.com \
--cc=george.dunlap@citrix.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=lin.liu@citrix.com \
--cc=sstabellini@kernel.org \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.