diff options
author | Karl Williamson <khw@cpan.org> | 2021-07-20 10:41:39 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2021-07-30 05:41:28 -0600 |
commit | 250e5324a59b505b79ee7b1dc924b0e8e5b51f95 (patch) | |
tree | 664af473905f4b4db84482551cde769034e91516 /inline.h | |
parent | e88dde507ccbbc2140c509d1e6b0a960d868c6d7 (diff) | |
download | perl-250e5324a59b505b79ee7b1dc924b0e8e5b51f95.tar.gz |
Comment why ffs() isn't used for lsbit_pos()
Diffstat (limited to 'inline.h')
-rw-r--r-- | inline.h | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -727,6 +727,15 @@ Perl_is_utf8_invariant_string_loc(const U8* const s, STRLEN len, const U8 ** ep) # endif #endif +/* The reason there are not checks to see if ffs() and ffsl() are available for + * determining the lsb, is because these don't improve on the deBruijn method + * fallback, which is just a branchless integer multiply, array element + * retrieval, and shift. The others, even if the function call overhead is + * optimized out, have to cope with the possibility of the input being all + * zeroes, and almost certainly will have conditionals for this eventuality. + * khw, at the time of this commit, looked at the source for both gcc and clang + * to verify this. (gcc used a method inferior to deBruijn.) */ + /* Below are functions to find the first, last, or only set bit in a word. On * platforms with 64-bit capability, there is a pair for each operation; the * first taking a 64 bit operand, and the second a 32 bit one. The logic is |