[PATCH] smallint
Bernhard Fischer
rep.dot.nop at gmail.com
Tue May 20 07:15:52 UTC 2008
On Tue, May 20, 2008 at 12:18:58AM +0200, Denys Vlasenko wrote:
>Hi,
>
>Attached patch instroduces smallint type, and uses it
>for flag variables. It results in size reduction
>ont only for bss, but text too:
>
> text data bss dec hex filename
>- 648 4 24 676 2a4 libc/misc/internals/__uClibc_main.o
>+ 645 4 21 670 29e libc/misc/internals/__uClibc_main.o
>- 129 0 4 133 85 libc/termios/tcgetsid.o
>+ 126 0 1 127 7f libc/termios/tcgetsid.o
>
>because "flag_var = 1" is a smaller instruction now.
>Size in smallint can be set per-architecture.
>
>I am a bit unsire I picked suitable include files to put
>new definitions in.
>
>Can someone eyeball the patch?
>--
>vda
>diff -d -urpN uClibc.1/libc/termios/tcgetsid.c uClibc.2/libc/termios/tcgetsid.c
>--- uClibc.1/libc/termios/tcgetsid.c 2008-05-19 16:23:16.000000000 +0200
>+++ uClibc.2/libc/termios/tcgetsid.c 2008-05-20 00:03:31.000000000 +0200
>@@ -34,7 +34,7 @@ tcgetsid (fd)
> pid_t pgrp;
> pid_t sid;
> #ifdef TIOCGSID
>- static int tiocgsid_does_not_work;
>+ static smallint tiocgsid_does_not_work;
For cases like this i prefer to just use a bool.
>
> if (! tiocgsid_does_not_work)
> {
More information about the uClibc
mailing list