This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Use simple-minded approach to bitwise UTF-8 operations
authorKarl Williamson <khw@cpan.org>
Wed, 7 Jun 2017 20:52:52 +0000 (14:52 -0600)
committerKarl Williamson <khw@cpan.org>
Wed, 7 Jun 2017 21:05:17 +0000 (15:05 -0600)
commit08b6664b858b8fd4b5c0c27542763337b6d78e46
tree8bb53c2431e9f3d3902a5ac0454c172bf0ddd355
parent7e99522f0b6c062201bce39342ac82ce222e634d
Use simple-minded approach to bitwise UTF-8 operations

Commit 5d09ee1cb7b68f5e6fd15233bfe5048612e8f949 fatalized bitwise
operations of operands with wide characters in them.  It retained the
regular UTF-8 handling, but throws an error when a wide character is
encountered.

But this code is complicated because of its original intended
generality.  It can essentially be ripped out, replaced by code that
just downgrades the operand to non-UTF-8.  Then we use the regular code
to do the operation.  In the complement case, that's all that need be
done to mimic earlier behavior, as the result has not been in UTF-8.
For the other operations, the result is simply upgraded to UTF-8.

This removes quite a few lines of code, and now the UTF-8 handling uses
the same tight loops as the non-UTF-8.  Downgrading and upgrading had to
be done specially before, but now they are done in tight loops, before
the operation, and after the operation
doop.c
pp.c