On Fri, 2012-05-18 at 17:31 +0000, Drews, Paul wrote:
> Ok, I have a version of the patch that I'm happy with at this point.
> () Builds with no errors or warning and works on 3.4-rc7
> () Passes checkpatch.pl
> () Does static-initialization of the bitmap in a way that lets the
> author specify the values in any old order. One incremental
> line of source-code per value. Pretty easy to maintain the
> list of values.
> () Relies on constant-folding to keep the bitmap initialization compact
> without extra footprint in code-section or data-section. This
> all works with shift operators instead of (shudder) bitfield operators
> I originally thought I would have to use.
> () Uses the standard bitops, no need to roll-your-own
> () Is 32-bit and 64-bit compatible with one #ifdef in the
> "boiler-plate" section of the code. I don't see a way around
> this #ifdef
Wow, that's pretty impressive :-) I gave up way earlier I guess.
> +#define ALL_MASKS(idx) ( \
> + CONDITIONAL_MASK(WLAN_EID_SSID, idx) | \
> +#define CONDITIONAL_MASK(ordinal, idx) \
> + ((BIT_WORD(ordinal) == idx) ? BIT_MASK(ordinal) : 0)
...
> +#if BITS_PER_LONG == 32
> +static DECLARE_BITMAP(singleton_map, 256) = {
> + [0] = ALL_MASKS(0),
> + [1] = ALL_MASKS(1),
> + [2] = ALL_MASKS(2),
> + [3] = ALL_MASKS(3),
> + [4] = ALL_MASKS(4),
> + [5] = ALL_MASKS(5),
> + [6] = ALL_MASKS(6),
> + [7] = ALL_MASKS(7),
> +};
> +#elif BITS_PER_LONG == 64
> +static DECLARE_BITMAP(singleton_map, 256) = {
> + [0] = ALL_MASKS(0),
> + [1] = ALL_MASKS(1),
> + [2] = ALL_MASKS(2),
> + [3] = ALL_MASKS(3),
> +};
> +#else
> +#error "adjust your <asm/bitsperlong.h> defines"
> +#endif
And we don't even need to touch this directly, nice!
johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Linux Kernel]
[Linux Bluetooth]
[Linux Netdev]
[Kernel Newbies]
[Share Photos]
[IDE]
[Security]
[Git]
[Netfilter]
[Bugtraq]
[Photo]
[Yosemite]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Linux ATA RAID]
[Samba]
[Video 4 Linux]
[Device Mapper]
[Linux Resources]
[Free Dating]
[M2M Wireless]