summaryrefslogtreecommitdiff
path: root/pp_pack.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-05-20 08:30:48 +0200
committerNicholas Clark <nick@ccl4.org>2009-05-20 10:50:04 +0200
commitefa50c51e3301a2ca8be765fedfdae78eff1615b (patch)
treeef032fdb284883023b030a999bb925240c7d24be /pp_pack.c
parent869053c868a03539389422a7a28502818825a940 (diff)
downloadperl-efa50c51e3301a2ca8be765fedfdae78eff1615b.tar.gz
Replace run-time on-demand initialisation of PL_bitcount with a constant table.
(The table is 256 bytes; the run-time initialisation code is larger than this!) Adapt generate_uudmap.c to generate the initalisation block for PL_bitcount, writing the code to bitcount.h, using the same approach as uudmap.h. To preserve binary compatibility: for MULTIPLICITY: keep Ibitcount in the interpreter structure, but remove all the macros that access it. PL_bitcount is a new symbol in the object file, which won't clash with anything as that name wasn't used before. otherwise: keep PL_bitcount as a char *, but initialise it at compile time to a new constant array PL_bitcount array. Remove the code that attempts to Safefree() it at interpreter destruction time.
Diffstat (limited to 'pp_pack.c')
-rw-r--r--pp_pack.c14
1 files changed, 0 insertions, 14 deletions
diff --git a/pp_pack.c b/pp_pack.c
index 0895c9bba9..31cc8eb25f 100644
--- a/pp_pack.c
+++ b/pp_pack.c
@@ -1477,20 +1477,6 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c
if (howlen == e_star || len > (strend - s) * 8)
len = (strend - s) * 8;
if (checksum) {
- if (!PL_bitcount) {
- int bits;
- Newxz(PL_bitcount, 256, char);
- for (bits = 1; bits < 256; bits++) {
- if (bits & 1) PL_bitcount[bits]++;
- if (bits & 2) PL_bitcount[bits]++;
- if (bits & 4) PL_bitcount[bits]++;
- if (bits & 8) PL_bitcount[bits]++;
- if (bits & 16) PL_bitcount[bits]++;
- if (bits & 32) PL_bitcount[bits]++;
- if (bits & 64) PL_bitcount[bits]++;
- if (bits & 128) PL_bitcount[bits]++;
- }
- }
if (utf8)
while (len >= 8 && s < strend) {
cuv += PL_bitcount[uni_to_byte(aTHX_ &s, strend, datumtype)];