Messages in this thread | | | Date | Sat, 27 Nov 1999 16:53:47 -0700 | From | Richard Gooch <> | Subject | Re: I never liked bitfields by some reason. |
| |
Pete Zaitcev writes: > Now I know why I did not like bitfields. The code below would > need no #ifdef if it used macroses like > #define W3_XCVR_MASK 0x00F00000 > or something to that effect... > > --- drivers/net/3c59x.c 1999/09/06 01:17:39 1.39 > +++ drivers/net/3c59x.c 1999/11/27 05:52:26 > @@ -366,10 +369,23 @@ > union wn3_config { > int i; > struct w3_config_fields { > +#if defined(__sparc__) > + int pad25:7; > + unsigned int autoselect:1; > + unsigned int xcvr:4; > + int pad18:2; > + unsigned int ram_split:2; > + int pad8:8; > + unsigned int rom_size:2; > + unsigned int ram_speed:2; > + unsigned int ram_width:1; > + unsigned int ram_size:3; > +#else > unsigned int ram_size:3, ram_width:1, ram_speed:2, rom_size:2; > int pad8:8; > unsigned int ram_split:2, pad18:2, xcvr:4, autoselect:1; > int pad24:7; > +#endif > } u; > };
Firstly: do you know *why* the code is done this way? Secondly: how do you know your solution won't need #ifdefs as well?
Regards,
Richard.... Permanent: rgooch@atnf.csiro.au Current: rgooch@ras.ucalgary.ca
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |