From e1fee49fb77fa1dc3ec7e76df02a2dee9b5087c6 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 24 Sep 2006 12:47:00 +0300 Subject: [PATCH] Bug 381: Halve sizeof(struct table_entry). Before: text data bss dec hex filename 54920 28528 3311 86759 152e7 src/intl/charsets.o 516064 85568 82112 683744 a6ee0 src/elinks After: text data bss dec hex filename 38958 28528 3311 70797 1148d src/intl/charsets.o 500112 85568 82112 667792 a3090 src/elinks So the text section shrank by 15962 bytes. Measured on i686-pc-linux-gnu with: --disable-xbel --disable-nls --disable-cookies --disable-formhist --disable-globhist --disable-mailcap --disable-mimetypes --disable-smb --disable-mouse --disable-sysmouse --disable-leds --disable-marks --disable-css --enable-small --enable-utf-8 --without-gpm --without-bzlib --without-idn --without-spidermonkey --without-lua --without-gnutls --without-openssl CFLAGS="-Os -ggdb -Wall" --- src/intl/charsets.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/intl/charsets.c b/src/intl/charsets.c index 76ee72e5..aee850fd 100644 --- a/src/intl/charsets.c +++ b/src/intl/charsets.c @@ -30,7 +30,14 @@ struct table_entry { unsigned char c; - unicode_val_T u; + /* This should in principle be unicode_val_T, but because all + * the values currently in codepage.inc fit in 16 bits, we can + * as well use uint16_t and halve sizeof(struct table_entry) + * from 8 bytes to 4. Should other characters ever be needed, + * unicode_val_T u : 24 might be a possibility, although it + * seems a little unportable as bitfields are in principle + * restricted to int, which may be 16-bit. */ + uint16_t u; }; struct codepage_desc {