From 29279548712f4865963d8755cd45b3ee52419fb8 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Mon, 14 Jun 2021 05:53:10 -0600 Subject: [PATCH] regcomp.c: Use single_1bit_pos() This new function replaces the code in this file. The new function will operate on 64-bit words, whereas only 32 bits are required here. But there should be no slowdown. --- regcomp.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/regcomp.c b/regcomp.c index 71dd06032bda..e7e83b737b21 100644 --- a/regcomp.c +++ b/regcomp.c @@ -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_pos(posixl); classnum = namedclass_to_classnum(namedclass); /* The named classes are such that the inverted number is one