diff options
author | Karl Williamson <khw@cpan.org> | 2021-06-05 10:22:42 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2021-07-30 05:41:27 -0600 |
commit | bf874180e9a7a8fbb74ab7eaa5c683ecc5a6ffc7 (patch) | |
tree | dcd3fbb669c5ffe256a551deac326fd1d66782df /regcomp.c | |
parent | 6e7a7813c390d2121876b9f8af4f37102e8d51fa (diff) | |
download | perl-bf874180e9a7a8fbb74ab7eaa5c683ecc5a6ffc7.tar.gz |
Create and use single_1bit_pos32()
This moves the code from regcomp.c to inline.h that calculates the
position of the lone set bit in a U32. This is in preparation for use
by other call sites.
Diffstat (limited to 'regcomp.c')
-rw-r--r-- | regcomp.c | 11 |
1 files changed, 1 insertions, 10 deletions
@@ -19398,17 +19398,8 @@ S_optimize_regclass(pTHX_ bool already_inverted; bool are_equivalent; - /* Compute which bit is set, which is the same thing as, e.g., - * ANYOF_CNTRL. From - * https://graphics.stanford.edu/~seander/bithacks.html#IntegerLogDeBruijn - * */ - static const int MultiplyDeBruijnBitPosition2[32] = { - 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, - 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9 - }; - namedclass = MultiplyDeBruijnBitPosition2[(posixl - * 0x077CB531U) >> 27]; + namedclass = single_1bit_pos32(posixl); classnum = namedclass_to_classnum(namedclass); /* The named classes are such that the inverted number is one |