diff options
| author | Paul Eggert | 2013-10-07 14:37:19 -0700 |
|---|---|---|
| committer | Paul Eggert | 2013-10-07 14:37:19 -0700 |
| commit | 595e113b15e2ce80b95d39d1851ce78f25ffa1f4 (patch) | |
| tree | 42c02de46a13e0af39fcc83de9d57c29e309f99e /nt | |
| parent | ddb317ba828f05eb48e98fda530443955485e75d (diff) | |
| download | emacs-595e113b15e2ce80b95d39d1851ce78f25ffa1f4.tar.gz emacs-595e113b15e2ce80b95d39d1851ce78f25ffa1f4.zip | |
Improve support for popcount and counting trailing zeros.
Do this by using the Gnulib modules for this.
This should generate faster code on non-GCC, non-MSC platforms,
and make the code a bit more portable, at least in theory.
* admin/merge-gnulib (GNULIB_MODULES): Add count-one-bits
and count-trailing-zeros.
* lib/count-one-bits.c, lib/count-one-bits.h:
* lib/count-trailing-zeros.c, lib/count-trailing-zeros.h:
* m4/count-one-bits.m4, m4/count-trailing-zeros.m4:
New files, copied from gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* nt/gnulib.mk: Merge changes from lib/gnulib.mk.
* src/data.c: Include <count-one-bits.h>, <count-trailing-zeros.h>.
(USE_MSC_POPCOUNT, POPCOUNT_STATIC_INLINE)
(NEED_GENERIC_POPCOUNT, popcount_size_t_generic)
(popcount_size_t_msc, popcount_size_t_gcc):
Remove; now done by Gnulib.
(popcount_size_t): Now a macro that defers to Gnulib.
(count_trailing_zero_bits): Return int, for consistency with
Gnulib and because Emacs prefers signed to unsigned int.
Don't assume that size_t is either unsigned int or unsigned long
or unsigned long long.
(size_t_to_host_endian): Do not assume that size_t is either
exactly 32 or exactly 64 bits wide.
* src/lisp.h (BITS_PER_SIZE_T): Define consistently with BITS_PER_LONG
etc., so that it's now an enum constant, not a macro.
No need to assume that it's either 32 or 64.
Fixes: debbugs:15550
Diffstat (limited to 'nt')
| -rw-r--r-- | nt/ChangeLog | 5 | ||||
| -rw-r--r-- | nt/gnulib.mk | 18 |
2 files changed, 22 insertions, 1 deletions
diff --git a/nt/ChangeLog b/nt/ChangeLog index 94bd71d28fd..390a8eb0227 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2013-10-07 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Improve support for popcount and counting trailing zeros (Bug#15550). | ||
| 4 | * gnulib.mk: Merge changes from ../lib/gnulib.mk. | ||
| 5 | |||
| 1 | 2013-10-04 Paul Eggert <eggert@cs.ucla.edu> | 6 | 2013-10-04 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 7 | ||
| 3 | * gnulib.mk: Create <byteswap.h> from <byteswap.in.h>. | 8 | * gnulib.mk: Create <byteswap.h> from <byteswap.in.h>. |
diff --git a/nt/gnulib.mk b/nt/gnulib.mk index ff46e9f09a6..f6a34013659 100644 --- a/nt/gnulib.mk +++ b/nt/gnulib.mk | |||
| @@ -43,7 +43,7 @@ | |||
| 43 | # the same distribution terms as the rest of that program. | 43 | # the same distribution terms as the rest of that program. |
| 44 | # | 44 | # |
| 45 | # Generated by gnulib-tool. | 45 | # Generated by gnulib-tool. |
| 46 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=dup --avoid=fchdir --avoid=fcntl --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat close-stream crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl-h fdatasync fdopendir filemode fstatat fsync getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings memrchr mktime pselect pthread_sigmask putenv qacl readlink readlinkat sig2str socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub unsetenv utimens warnings | 46 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt byteswap c-ctype c-strcase careadlinkat close-stream count-one-bits count-trailing-zeros crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir filemode fstatat fsync getloadavg getopt-gnu gettime gettimeofday intprops largefile lstat manywarnings memrchr mkostemp mktime pipe2 pselect pthread_sigmask putenv qacl readlink readlinkat sig2str socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub unsetenv utimens warnings |
| 47 | 47 | ||
| 48 | 48 | ||
| 49 | MOSTLYCLEANFILES += core *.stackdump | 49 | MOSTLYCLEANFILES += core *.stackdump |
| @@ -121,6 +121,22 @@ EXTRA_DIST += close-stream.h | |||
| 121 | 121 | ||
| 122 | ## end gnulib module close-stream | 122 | ## end gnulib module close-stream |
| 123 | 123 | ||
| 124 | ## begin gnulib module count-one-bits | ||
| 125 | |||
| 126 | libgnu_a_SOURCES += count-one-bits.c | ||
| 127 | |||
| 128 | EXTRA_DIST += count-one-bits.h | ||
| 129 | |||
| 130 | ## end gnulib module count-one-bits | ||
| 131 | |||
| 132 | ## begin gnulib module count-trailing-zeros | ||
| 133 | |||
| 134 | libgnu_a_SOURCES += count-trailing-zeros.c | ||
| 135 | |||
| 136 | EXTRA_DIST += count-trailing-zeros.h | ||
| 137 | |||
| 138 | ## end gnulib module count-trailing-zeros | ||
| 139 | |||
| 124 | ## begin gnulib module crypto/md5 | 140 | ## begin gnulib module crypto/md5 |
| 125 | 141 | ||
| 126 | libgnu_a_SOURCES += md5.c | 142 | libgnu_a_SOURCES += md5.c |