Thread (7 messages) flat view 7 messages, 3 authors, 2011-08-10

Re: union/struct representations for MAS Registers

From: Kumar Gala <hidden>
Date: 2011-08-10 17:48:12

On Aug 10, 2011, at 12:38 PM, David Laight wrote:
=20
quoted
quoted
Bitfields are rather non-portable, the compiler has a lot of choice
about how to align the bits in memory.
=20
I'm ok with the masking stuff.
However, I'm actually surprised this is true given the=20
maturity of our ABIs.
=20
The C standard says nothing at all about how bitfields are =
implemented,
I think the first bit might be 0x1, 0x80, 0x1000000 or 0x80000000
when treated as a 32bit value, regardless of the endianness.
=20
Different architectures can (and do) assign things in different ways.
So code that is ok on ppc might fail on arm or x86 (etc).
=20
	David
I think PPCs a bit sane and what Jimi was proposing the union for is =
something that would never need to be portable (as it a PPC specific =
register).

Still, prefer the shifts, masks & macros as that's what I've been =
reading & using in ppc land forever ;)

- k=
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help