Search Linux Wireless

Re: [PATCH] ath9k: decrease size of ath9k.ko

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2010/3/3 Pavel Roskin <proski@xxxxxxx>:
> On Mon, 2010-03-01 at 23:13 +0800, Ming Lei wrote:
>> -             int valid;
>> -             int valid_single_stream;
>> +             u8 valid;
>> +             u8 valid_single_stream;
>
> You can use bool instead, and that would give the same size saving while
> being even more descriptive.  I think using bool could be safer, as the
> compiler would be able to detect some misuses and the values.
>
> But I could get even more saving by using bool with the field width:
>
> bool valid:1;
> bool valid_single_stream:1;
>
> That would place both variables into one byte.  It may be ineffective
> for speed, but it's more effective for storage.
>
> In my configuration, I get following sizes:
>
> original (int):    2792138
> your patch (u8):   2790186
> bool:              2790186
> bool (1 bit):      2789218

1bit is not enough, at least 3bit is required for each one.

We does not save more using bit field since size of the least type
is 1 byte.

-- 
Lei Ming
--
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

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux