]> git.ipfire.org Git - thirdparty/coreutils.git/commit
wc: improve avx2 API
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 23 Sep 2023 20:38:08 +0000 (13:38 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 24 Sep 2023 00:07:52 +0000 (17:07 -0700)
commit8d41285fe494613a732f8060606d68ea3a8181d0
treea8962c3f15e1f9b50e09a8d121075d714eff158b
parent769ace51e8a1129c44ee4e7e209c3b2df2111524
wc: improve avx2 API

* src/wc.c: Use "#include <...>" for files not in the current dir.
Include "wc.h" instead of declaring wc_lines_avx2 by hand.
(wc_lines): New API, with no file name (no longer needed) and
with a return struct rather than arg pointers.  All uses changed.
Use avx2_supported directly instead of using a function pointer.
Exploit C99-style declarations after statements.
Multiply by 15 rather than dividing; it’s faster and more accurate
and cannot overflow here.
(wc): Simplify based on wc_lines API change.
* src/wc.h: New file.
* src/wc_avx2.c: Include it, to check API better.
(wc_lines_avx2): Use new API.  All uses changed.  Exploit C99.
Make locals more local.
src/wc.c
src/wc.h [new file with mode: 0644]
src/wc_avx2.c