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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: David Vrabel
Date: Wednesday, August 27, 2008 - 8:20 am

Al Viro wrote:

But why is this worthy of a crispy flaming?  I've not seen anything
definite beyond a somewhat vague 'some compilers don't optimize
bitfields very well'.

The structure definition and the DECL_BF_LEx() macros might be ugly but
the code using the structures is clearer.  For example,

    get_random_bytes(&tiebreaker, sizeof(unsigned));
    drp_ie->tiebreaker = tiebreaker & 1;

versus

    get_random_bytes(&tiebreaker, sizeof(unsigned));
    drp_ie->drp_control |= (tiebreaker & 1)
            ? UWB_DRP_IE_DRP_CTRL_TIEBREAKER : 0;

David
-- 
David Vrabel, Senior Software Engineer, Drivers
CSR, Churchill House, Cambridge Business Park,  Tel: +44 (0)1223 692562
Cowley Road, Cambridge, CB4 0WZ                 http://www.csr.com/
--
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, David Vrabel, (Wed Aug 27, 8:20 am)
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)