Skip to content

Commit

Permalink
regcomp.c: Use single_1bit_pos()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
khwilliamson committed Jun 14, 2021
1 parent 0fc8a56 commit 2927954
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions regcomp.c
Expand Up @@ -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
Expand Down

0 comments on commit 2927954

Please sign in to comment.