Skip to content

regcomp_invlist.c: Perl_populate_bitmap_from_invlist() optimize asserts #23376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: blead
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion regcomp_invlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,19 @@ void
Perl_populate_bitmap_from_invlist(pTHX_ SV * invlist, const UV offset, const U8 * bitmap, const Size_t len)
{
PERL_ARGS_ASSERT_POPULATE_BITMAP_FROM_INVLIST;
ASSUME(invlist && bitmap);

/* As the name says. The zeroth bit corresponds to the code point given by
* 'offset' */

UV start, end;

Zero(bitmap, len, U8);
if (len == sizeof(U64)
&& ( ((STRUCT_OFFSET(struct regnode_bbm, bitmap) % 8) == 0)
|| (PTR2nat(bitmap) & 0x7) == 0))
*(U64*)bitmap = 0;
else
Zero(bitmap, len, U8);

invlist_iterinit(invlist);
while (invlist_iternext(invlist, &start, &end)) {
Expand Down
Loading