This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
handy.h: Free up bits in PL_charclass[]
authorKarl Williamson <public@khwilliamson.com>
Fri, 20 Jul 2012 03:53:06 +0000 (21:53 -0600)
committerKarl Williamson <public@khwilliamson.com>
Wed, 25 Jul 2012 03:13:49 +0000 (21:13 -0600)
commitf4cdb42cbeec255c36ec708cc36f0243138d9645
tree1360a88dc85ec0762a204a210aafb4b15eb04001
parent430b7c7009472449aece84a5288fb71719d8418f
handy.h: Free up bits in PL_charclass[]

This array is a bit map containing the Posix and similar character
classes for the first 256 code points.  Prior to this commit many
character classes were represented by two bits, one for characters that
are in it over the full Latin-1 range, and one for just the ASCII
characters that are in it.  The number of bits in use was approaching
the 32-bit limit available without playing games.

This commit takes advantage of a recent commit that adds a bit to the
table for all the ASCII characters, and the fact that the ASCII
characters in a character class are a subset of the full Latin1
range.  So, iff both the full-range character class bit and the ASCII
bit is set is that character an ASCII-range character with the given
character class.

A new internal macro is created to generate code to determine if a
character is an ASCII range character with the given class.  It's not
clear if the generated code is faster or slower than the full range
version.

The result is that nearly half the bits are freed up, as the ones for
the ASCII-range are now redundant.
handy.h
l1_char_class_tab.h
regen/mk_PL_charclass.pl