From: "H. Peter Anvin" <hpa@zytor.com>
To: Neil Horman <nhorman@tuxdriver.com>
Cc: dev@dpdk.org, "H. Peter Anvin" <hpa@linux.intel.com>
Subject: Re: [dpdk-dev] [RFC UNTESTED PATCH] eal_common_cpuflags: Fix %rbx corruption, and simplify the code
Date: Mon, 24 Mar 2014 09:11:12 -0700 [thread overview]
Message-ID: <53305920.7000206@zytor.com> (raw)
In-Reply-To: <20140324160647.GF19368@hmsreliant.think-freely.org>
On 03/24/2014 09:06 AM, Neil Horman wrote:
>>
>> If C99-style initializers are permitted in this codebase, I would
>> strongly recommend using them, and then drop the enum field in struct
>> feature_entry and use a macro such as:
>>
> Actually, its a bit simpler than that, the enum parameter is actually completely
> unused, and so can be removed entirely. The FEAT_DEF macro does what you
> suggest below already, but only for the feature and name fields.
>
> I'll remove the enum and its definition, and augment the macro to cover the rest
> of the fields.
>
> Neil
>
>> #define FEAT(name,leaf,subleaf,reg,bit) \
>> [RTE_CPUFLAG_##f] = { leaf, subleaf, reg, bit, #f },
>>
>> (I'd move the string to the end, but that is just a microoptimization.
>> I'm kind of OCD that way.)
>>
The nice thing with the C99 initializer is that even if the order is
mismatched between the .c file and the .h file which defines the enum,
things still work correctly.
-hpa
next prev parent reply other threads:[~2014-03-24 16:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-20 16:44 H. Peter Anvin
2014-03-20 16:55 ` Neil Horman
2014-03-20 17:03 ` H. Peter Anvin
2014-03-24 16:06 ` Neil Horman
2014-03-24 16:11 ` H. Peter Anvin [this message]
[not found] <1395330830-1310-1-git-send-email-hpa@linux.intel.com>
2014-03-20 16:39 ` Neil Horman
2014-03-20 17:02 ` Thomas Monjalon
2014-03-20 18:04 ` Neil Horman
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=53305920.7000206@zytor.com \
--to=hpa@zytor.com \
--cc=dev@dpdk.org \
--cc=hpa@linux.intel.com \
--cc=nhorman@tuxdriver.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).