[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <46891A99.7090003@garzik.org>
Date: Mon, 02 Jul 2007 11:32:41 -0400
From: Jeff Garzik <jeff@...zik.org>
To: "Kok, Auke" <auke-jan.h.kok@...el.com>
CC: Arjan van de Ven <arjan@...ux.intel.com>,
Ayyappan Veeraiyan <ayyappan.veeraiyan@...el.com>,
netdev@...r.kernel.org, akpm@...ux-foundation.org
Subject: Re: [PATCH] ixgbe: Introduce new 10GbE driver for Intel 82598 based
PCI Express adapters...
Kok, Auke wrote:
> Maybe this is not most important for ixgbe, where we only have 8 or so
> flags, but the new e1000 driver that I posted this weekend currently has
> 63 (you wanted flags ;)) of them. Do you want me to use 63 integers or
> just 2 ?
Don't be silly. We are talking about single-bit feature flags
implemented using machine ints (a la tg3 with 32 flags per int), versus
bitfields.
Bitfields are to be avoided for many reasons:
* more difficult, in general, for a compiler to generate optimal code
* in particular, known to generate worse code on various architectures
* often causes endian problems
* often enhances programmer confusion, when trying to review structs and
determine optimal layout and alignment
* programmers have proven they will screw up bitfields in e.g. cases
with 1-bit and signedness.
I can probably think up more reasons to avoid bitfields if given another
5 minutes :)
Jeff
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists