[PATCH 2/2] first stab at NOFORK applet support
Rob Landley
rob at landley.net
Wed May 10 17:37:37 UTC 2006
On Tuesday 09 May 2006 4:27 pm, Bernhard Fischer wrote:
> Just a quick sidenote..
> Perhaps it'd be better to use bitfield for the pure true/false values like
> be_quiet, in_place:
> struct sed_globals
> /* options */
> __extension__ unsigned be_quiet:1;
> __extension__ unsigned in_place:3;/*or how many you need*/
> ...
> }
> Even with the implied padding you'd call for by only using 1+3, you'd
> save a little bit there, eventually.
>
> cheers,
Bitfields tend to save data at the expense of code size (the extra shift and
mask), but now that it's in a structure that's definitely one of the options
we've got. (P.S. I love bloat-o-meter. It's really really really really
cool. If you haven't tried "make bloatcheck" yet, you should. :)
I just converted mdev.c in my local tree to use a similar struct for its
measly two static variables, and now I'm working out the shared
infrastructure to put them into a union. Once that's in, we can convert
other stuff over one at a time.
One thing I'm worried about is that the union might screw up the compiler's
optimizer. (The "strict aliasing" stuff, and such.) I could always make
union vs separate structs a config option, although I'd really rather not...
Rob
--
Never bet against the cheap plastic solution.
More information about the busybox
mailing list