From: Luis R. Rodriguez Date: Wed, 3 Mar 2010 16:54:33 -0800 Subject: [ath9k-devel] [PATCH] ath9k: decrease size of ath9k.ko In-Reply-To: <1267592564.4725.11.camel@mj> References: <1267289803-6795-1-git-send-email-tom.leiming@gmail.com> <4B89520D.1000209@lwfinger.net> <4B89E0D7.9020103@lwfinger.net> <20100301231329.64e3dd3b@tom-lei> <1267592564.4725.11.camel@mj> Message-ID: <20100304005433.GA8410@tux> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: ath9k-devel@lists.ath9k.org On Tue, Mar 02, 2010 at 09:02:44PM -0800, Pavel Roskin wrote: > 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 Or use flags, and use BIT(1), BIT(2), etc for #defines for each stream mode. Would save even more. Luis