[linux-dvb] dvb-apps lib, structs declared with bit fields

Oivind oivindg at gmail.com
Tue Jul 5 15:17:44 CEST 2005


I notice that bit fields are used in many of the structs, as for
example from en50221_hlci.h;

struct en50221_pmt_object {
        unsigned ca_pmt_tag: 24;
        uint8_t *asn_1_length;
        unsigned ca_pmt_list_mgmt: 8;
        unsigned program_number: 16;
        unsigned reserved_1: 2;

        [...]

};


What exactly is the benefit of this? 

Bit fields generate a lot of cpu overhead for the shifting etc needed,
inserted by the compiler, and todays hardware will most likely have
the memory required for normal declarations.


Oivind




More information about the linux-dvb mailing list