From: "M. Warner Losh" <imp@bsdimp.com>
To: qemu-devel@nongnu.org, schwab@suse.de
Subject: Re: [Qemu-devel] [PATCH] pcnet32 driver change, please test
Date: Sat, 03 Mar 2007 06:24:52 -0700 (MST) [thread overview]
Message-ID: <20070303.062452.129711022.imp@bsdimp.com> (raw)
In-Reply-To: <jemz2uvd2u.fsf@sykes.suse.de>
In message: <jemz2uvd2u.fsf@sykes.suse.de>
Andreas Schwab <schwab@suse.de> writes:
: Paul Brook <paul@codesourcery.com> writes:
:
: >> : I find this curious... C99 (6.7.2.1) says "the allocation order of
: >> : bit-fields within a unit (high-order to low-order or low-order to
: >> : high-order) is implementation defined". I can't see any requirement
: >> : for this, so is it just convention that bitfields on big endian systems
: >> : start from the most significant bit, and those on little endian systems
: >> : start from the least significant bit? (My thinking is that endianness
: >> : usually refers to byte ordering and not so much bit ordering.)
: >>
: >> This is a convention that goes back a very long ways. It was this way
: >> in the mid 1980's, and has remained true through today. I've
: >> personally observed this to be the case on many different MIPS
: >> compilers, ARM compilers and SPARC compilers over the years.
: >
: > I'm fairly sure I've seen targets that use other bitfield orderings, though I
: > can't remember offhand what they were.
:
: Bi-endian targets are examples of this. The bitfield ordering is normally
: independent of the selected byte order. For example, big-endian MIPS has
: little endian bit order.
Except that compilers use the convention that was described above.
Big endian MIPS definitely uses a different bit ordering for C bit
fields than little endian MIPS. This is true for compilers from SGI,
DEC and GNU and NetBSD, FreeBSD, Linux, Ultrix, OSF, and IRIX. All of
them use the following, or variants for, say, the IP header:
struct ip {
#if BYTE_ORDER == LITTLE_ENDIAN
unsigned int ip_hl:4, /* header length */
ip_v:4; /* version */
#endif
#if BYTE_ORDER == BIG_ENDIAN
unsigned int ip_v:4, /* version */
ip_hl:4; /* header length */
#endif
...
Warner
next prev parent reply other threads:[~2007-03-03 13:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-02 20:09 [Qemu-devel] [PATCH] pcnet32 driver change, please test Thiemo Seufer
2007-03-02 20:29 ` Thiemo Seufer
2007-03-03 0:38 ` Fabrice Bellard
2007-03-03 21:44 ` Thiemo Seufer
2007-03-02 23:14 ` Stuart Brady
2007-03-03 0:53 ` M. Warner Losh
2007-03-03 1:01 ` Paul Brook
2007-03-03 2:30 ` M. Warner Losh
2007-03-03 10:25 ` Andreas Schwab
2007-03-03 13:24 ` M. Warner Losh [this message]
2007-03-03 14:46 ` Andreas Schwab
2007-03-03 15:47 ` M. Warner Losh
2007-03-03 17:23 ` Andreas Schwab
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=20070303.062452.129711022.imp@bsdimp.com \
--to=imp@bsdimp.com \
--cc=qemu-devel@nongnu.org \
--cc=schwab@suse.de \
/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.