Re: [patch] Add helper macros for little-endian bitfields

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linus Torvalds
Date: Wednesday, August 27, 2008 - 2:26 pm

On Wed, 27 Aug 2008, David Vrabel wrote:

Actually, it's not that compilers often optimize bitfields really badly.

It's also that bitfields are a total f*cking disaster when it comes to 
endianness. As you found out.

Bitfields are fine if you don't actually care about the underlying format, 
and want gcc to just randomly assign bits, and want things to be 
convenient in that situation.

But _if_ you care about the underlying format, then inevitably the 
bitfield costs will be much higher than just using bit operations on a
"u32" or similar. Your helper macros are horrible compared to just making 
the bits work out right to begin with, and using the standard byte order 
things.

		Linus
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch] bitmap: add bitmap_copy_le(), David Vrabel, (Thu Aug 21, 6:19 am)
[patch] Add helper macros for little-endian bitfields, David Vrabel, (Thu Aug 21, 6:20 am)
Re: [patch] Add helper macros for little-endian bitfields, Roland Dreier, (Sun Aug 24, 6:37 pm)
Re: [patch] Add helper macros for little-endian bitfields, Jeremy Fitzhardinge, (Wed Aug 27, 2:19 pm)
Re: [patch] Add helper macros for little-endian bitfields, Linus Torvalds, (Wed Aug 27, 2:26 pm)