Coding style: bit fields
The echoaudio driver has many flags in chip_t stored as bit fields. It doesn't save any space because accessing a bitfield requires more instructions than accessing a byte. Eg. ppc needs one instruction to write a char and three instructions to write a bitfield (load, modify, store, 12 bytes...). I'm thinking about replacing all af them with chars. Is it ok ?
--
Giuliano.
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
At Sat, 19 Feb 2005 18:37:26 +0100,
Quoted 6 lines · Giuliano Pochini
The echoaudio driver has many flags in
chip_tstored as bit fields. It doesn't save any space because accessing a bitfield requires more instructions than accessing a byte. Eg. ppc needs one instruction to write a char and three instructions to write a bitfield (load, modify, store, 12 bytes...). I'm thinking about replacing all af them with chars. Is it ok ?
Sure, go ahead!
Takashi
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
Quoted 10 lines · On Tue, 22 Feb 2005 22:04:08 +0100 Takashi Iwai <[email protected]> wrote:
At Sat, 19 Feb 2005 18:37:26 +0100,
Quoted 6 lines · Giuliano Pochini
The echoaudio driver has many flags in
chip_tstored as bit fields. It doesn't save any space because accessing a bitfield requires more instructions than accessing a byte. Eg. ppc needs one instruction to write a char and three instructions to write a bitfield (load, modify, store, 12 bytes...). I'm thinking about replacing all af them with chars. Is it ok ?Sure, go ahead!
Fine.
pci/echoaudio/echoaudio.h +9 -9
@@ -389,15 +389,15 @@u8 input_clock;/* Currently selected sample clock source */ u8 output_clock;/* Layla20 only */ - unsigned int meters_enabled : 1; /* VU-meters status */ - unsigned int asic_loaded : 1; /* Set TRUE when ASIC loaded */ - unsigned int bad_board : 1; /* Set TRUE if DSP won't load */ - unsigned int professional_spdif : 1; /* 0 = consumer; 1 = professional */ - unsigned int non_audio_spdif : 1; /* 3G - only */ - unsigned int digital_in_automute : 1; /* Gina24, Layla24, Mona - only */ - unsigned int phantom_power : 1; /* Gina3G - only */ - unsigned int has_midi : 1; - unsigned int midi_input_enabled : 1; +char meters_enabled;/* VU-meters status */ +char asic_loaded;/* Set TRUE when ASIC loaded */ +char bad_board;/* Set TRUE if DSP won't load */ +char professional_spdif;/* 0 = consumer; 1 = professional */ +char non_audio_spdif;/* 3G - only */ +char digital_in_automute;/* Gina24, Layla24, Mona - only */ +char phantom_power;/* Gina3G - only */ +char has_midi; +char midi_input_enabled;char nominal_level[ECHO_MAXAUDIOPIPES ];/* True == -10dBV False == +4dBu */ s8 input_gain[ECHO_MAXAUDIOINPUTS ];/* Input level -50..+50 unit is 0.5dB */
--
Giuliano.
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
At Sat, 26 Feb 2005 19:59:18 +0100,
Quoted 13 lines · Giuliano Pochini
Quoted 9 lines · On Tue, 22 Feb 2005 22:04:08 +0100 Takashi Iwai <[email protected]> wrote:
At Sat, 19 Feb 2005 18:37:26 +0100,
Quoted 6 lines · Giuliano Pochini
The echoaudio driver has many flags in
chip_tstored as bit fields. It doesn't save any space because accessing a bitfield requires more instructions than accessing a byte. Eg. ppc needs one instruction to write a char and three instructions to write a bitfield (load, modify, store, 12 bytes...). I'm thinking about replacing all af them with chars. Is it ok ?
Quoted 6 lines
Quoted 1 line
Sure, go ahead!
Fine.
Signed-off-by Giuliano Pochini <[email protected]>
Thanks, now it's on CVS.
Takashi
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click