Bitfields

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Mar 2008
Posts: 9
Reputation: os.hacker64 is an unknown quantity at this point 
Solved Threads: 0
os.hacker64 os.hacker64 is offline Offline
Newbie Poster

Bitfields

 
0
  #1
Mar 13th, 2008
How does gcc order bitfields on a little-endian machine? Is the first entry the most significant bit or what?
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 9
Reputation: os.hacker64 is an unknown quantity at this point 
Solved Threads: 0
os.hacker64 os.hacker64 is offline Offline
Newbie Poster

Re: Bitfields

 
0
  #2
Mar 13th, 2008
bump
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,802
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 747
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Bitfields

 
0
  #3
Mar 13th, 2008
>Is the first entry the most significant bit or what?
IIRC, it's or what.

>bump
Don't bump your threads, it's rude. I mean really, is 30 minutes really that long to wait? It's not like Daniweb is a real-time chat with paid people helping 24/7 or anything.
Last edited by Narue; Mar 13th, 2008 at 5:07 pm.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 9
Reputation: os.hacker64 is an unknown quantity at this point 
Solved Threads: 0
os.hacker64 os.hacker64 is offline Offline
Newbie Poster

Re: Bitfields

 
0
  #4
Mar 13th, 2008
As for the question?
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,802
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 747
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Bitfields

 
0
  #5
Mar 13th, 2008
>As for the question?
Sorry, I guess my joke was too subtle. The answer is "or what". IIRC, when you have the following in gcc, a is the least significant bit:
  1. struct foo {
  2. unsigned int a:1;
  3. unsigned int b:1;
  4. };
Last edited by Narue; Mar 13th, 2008 at 5:39 pm.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 1,668
Reputation: jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of 
Solved Threads: 123
jephthah's Avatar
jephthah jephthah is offline Offline
Posting Virtuoso

Re: Bitfields

 
0
  #6
Mar 14th, 2008
Originally Posted by os.hacker64 View Post
How does gcc order bitfields on a little-endian machine? Is the first entry the most significant bit or what?
endianness referrs to byte ordering, not bits. bit ordering is always the same. endianness describes the direction that bytes are stored in increasing memory locations. big-endian means "big end first". little-endian means "little end first"

but really, it all comes down to the fact that the Blefuscudians are stupid fools who ruin perfectly good soft-boiled eggs.
Last edited by jephthah; Mar 14th, 2008 at 3:24 pm.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC