lkml.org 
[lkml]   [1999]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 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/

\
 
 \ /
  Last update: 2005-03-22 13:55    [from the cache]
©2003-2011 Jasper Spaans