[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
stdbit-h, stdc_*: New modules, part of the stdbit module
From: |
Bruno Haible |
Subject: |
stdbit-h, stdc_*: New modules, part of the stdbit module |
Date: |
Thu, 16 May 2024 01:06:25 +0200 |
The module 'stdbit' defines 70 functions, grouped into 14 function-like
macros. Most packages will only need 1 or 2 among these 14 function groups.
(For example, diffutils needs only 'stdc_bit_width'.)
The amount of code generated by the stdbit module is not negligible:
With gcc -O0:
$ size gllib/stdbit.o
text data bss dec hex filename
5346 0 0 5346 14e2 gllib/stdbit.o
With gcc -O2:
$ size gllib/stdbit.o
text data bss dec hex filename
3811 0 0 3811 ee3 gllib/stdbit.o
Therefore it is useful to split the functionality into 14 modules.
The patch below does this, thus allowing the using packages to request
only the parts they need, and thereby shrink the resulting binaries by
3 to 5 KB.
We thus have the following modules:
- stdbit-h for just the header file,
- stdc_* for the 14 function groups,
- stdbit for all together.
This is similar to the structure of the modules
error
glob
pthread
threads
2024-05-15 Bruno Haible <bruno@clisp.org>
stdbit-h, stdc_*: New modules, part of the stdbit module.
* lib/stdbit.in.h (_GL_STDC_*_INLINE): New macros.
Enclose function definitions in #if @GL_STDC_*@ conditionals.
* lib/stdc_leading_zeros.c: New file.
* lib/stdc_leading_ones.c: New file.
* lib/stdc_trailing_zeros.c: New file.
* lib/stdc_trailing_ones.c: New file.
* lib/stdc_first_leading_zero.c: New file.
* lib/stdc_first_leading_one.c: New file.
* lib/stdc_first_trailing_zero.c: New file.
* lib/stdc_first_trailing_one.c: New file.
* lib/stdc_count_zeros.c: New file.
* lib/stdc_count_ones.c: New file, based on lib/stdbit.c.
* lib/stdc_has_single_bit.c: New file.
* lib/stdc_bit_width.c: New file.
* lib/stdc_bit_floor.c: New file.
* lib/stdc_bit_ceil.c: New file.
* lib/stdbit.c (__gl_stdbit_popcount_support): Remove variable.
* m4/stdbit_h.m4 (gl_STDBIT_H): Initialize GL_STDC_* variables.
* modules/stdbit-h: New file, based on modules/stdbit.
(Depends-on): Add gen-header.
(Makefile.am): Substitute GL_STDC_* variables.
* modules/stdc_leading_zeros: New file.
* modules/stdc_leading_ones: New file.
* modules/stdc_trailing_zeros: New file.
* modules/stdc_trailing_ones: New file.
* modules/stdc_first_leading_zero: New file.
* modules/stdc_first_leading_one: New file.
* modules/stdc_first_trailing_zero: New file.
* modules/stdc_first_trailing_one: New file.
* modules/stdc_count_zeros: New file.
* modules/stdc_count_ones: New file.
* modules/stdc_has_single_bit: New file.
* modules/stdc_bit_width: New file.
* modules/stdc_bit_floor: New file.
* modules/stdc_bit_ceil: New file.
* modules/stdbit: Change to a pure composition module.
* modules/stdc_leading_zeros-tests: New file, based on
modules/stdbit-tests.
* modules/stdc_leading_ones-tests: New file, based on
modules/stdbit-tests.
* modules/stdc_trailing_zeros-tests: New file, based on
modules/stdbit-tests.
* modules/stdc_trailing_ones-tests: New file, based on
modules/stdbit-tests.
* modules/stdc_first_leading_zero-tests: New file, based on
modules/stdbit-tests.
* modules/stdc_first_leading_one-tests: New file, based on
modules/stdbit-tests.
* modules/stdc_first_trailing_zero-tests: New file, based on
modules/stdbit-tests.
* modules/stdc_first_trailing_one-tests: New file, based on
modules/stdbit-tests.
* modules/stdc_count_zeros-tests: New file, based on
modules/stdbit-tests.
* modules/stdc_count_ones-tests: New file, based on
modules/stdbit-tests.
* modules/stdc_has_single_bit-tests: New file, based on
modules/stdbit-tests.
* modules/stdc_bit_width-tests: New file, based on modules/stdbit-tests.
* modules/stdc_bit_floor-tests: New file, based on modules/stdbit-tests.
* modules/stdc_bit_ceil-tests: New file, based on modules/stdbit-tests.
* modules/stdbit-tests: Remove file.
* doc/posix-functions/stdc_leading_zeros.texi: Update.
* doc/posix-functions/stdc_leading_ones.texi: Likewise.
* doc/posix-functions/stdc_trailing_zeros.texi: Likewise.
* doc/posix-functions/stdc_trailing_ones.texi: Likewise.
* doc/posix-functions/stdc_first_leading_zero.texi: Likewise.
* doc/posix-functions/stdc_first_leading_one.texi: Likewise.
* doc/posix-functions/stdc_first_trailing_zero.texi: Likewise.
* doc/posix-functions/stdc_first_trailing_one.texi: Likewise.
* doc/posix-functions/stdc_count_zeros.texi: Likewise.
* doc/posix-functions/stdc_count_ones.texi: Likewise.
* doc/posix-functions/stdc_has_single_bit.texi: Likewise.
* doc/posix-functions/stdc_bit_width.texi: Likewise.
* doc/posix-functions/stdc_bit_floor.texi: Likewise.
* doc/posix-functions/stdc_bit_ceil.texi: Likewise.
0001-stdbit-h-stdc_-New-modules-part-of-the-stdbit-module.patch
Description: Text Data
- stdbit-h, stdc_*: New modules, part of the stdbit module,
Bruno Haible <=