public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Etienne Lorrain" <etienne_lorrain@yahoo.fr>
To: gcc@gcc.gnu.org
Subject: Re: How to change bit-field allocation
Date: Tue, 07 Sep 2004 14:59:00 -0000	[thread overview]
Message-ID: <20040907145951.77752.qmail@web11802.mail.yahoo.com> (raw)

Min ZOU wrote:
> Robert Dewar wrote:
> > I guess that the problem is that he wants a magical way of dealing with
> > endian differences between processors. Many people want this, but
> > unfortunately there is no coherent consistent way of doing this.
> > This topic has been much studied and discussed in the Ada world :-)
>
> The problem is not due to endian differences but compiler differences. I >
came across this problem when I have to combine two binary images while
> are compiled by different compilers: one by GCC, the other by SH
> proprietary compiler. However the bit-field's members are allocated from
> the lower bit in GCC, while from higher bit in SH compiler.

  I had the impression that only one logical way was possible depending
 on the processor, so that:

union {
  unsigned char val1;
  unsigned      val2 : 8;
  unsigned char val3[1];
  struct { unsigned char c1, c2; } val3;
  ... whatever ...
  } a_union;

 the value of "a_union.val1", "a_union.val2",  "a_union.val3[0]" and
 "a_union.val3.c1" are identical - assuming 8 bits chars.

  Same for (assuming 16 bits shorts):
union {
  unsigned short val1;
  unsigned       val2 : 16;
  enum { e1, e2, e3 } val3 : 16;
  } union2;

  Etienne.


	

	
		
Vous manquez dÂ’espace pour stocker vos mails ? 
Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com

             reply	other threads:[~2004-09-07 14:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-07 14:59 Etienne Lorrain [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-09-06 11:41 Min ZOU
2004-09-06 17:15 ` Ramana Radhakrishnan
2004-09-06 21:43 ` James E Wilson
2004-09-06 22:19   ` Robert Dewar
2004-09-07  3:44     ` Min ZOU
2004-09-07 15:56   ` Dave Korn
2004-09-13  9:09   ` tm_gccmail
2004-09-07  1:24 ` DJ Delorie
2004-09-07  3:47   ` Min ZOU
2004-09-07 14:07     ` Robert Dewar

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=20040907145951.77752.qmail@web11802.mail.yahoo.com \
    --to=etienne_lorrain@yahoo.fr \
    --cc=gcc@gcc.gnu.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 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 read-only IMAP folder(s) and NNTP newsgroup(s).