diff options
author | Karl Williamson <public@khwilliamson.com> | 2011-09-21 10:06:21 -0600 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2011-09-21 10:23:56 -0600 |
commit | 83fd1222cb70cfbc25e305b52ff9d2bb0539ca8c (patch) | |
tree | 503673bbfb030e8ee5997801fcd900aa9600d754 /lib | |
parent | ca420de31dd6b64a0b6c6516effc515706e0e608 (diff) | |
download | perl-83fd1222cb70cfbc25e305b52ff9d2bb0539ca8c.tar.gz |
UCD.pm: Only calculate hex once
This uses intermediate variables to store the output of hex(), with the
result that if there is an $end, its hex only is calculated once.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Unicode/UCD.pm | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Unicode/UCD.pm b/lib/Unicode/UCD.pm index 7e43704f93..e18bd602b2 100644 --- a/lib/Unicode/UCD.pm +++ b/lib/Unicode/UCD.pm @@ -6,7 +6,7 @@ no warnings 'surrogate'; # surrogates can be inputs to this use charnames (); use Unicode::Normalize qw(getCombinClass NFD); -our $VERSION = '0.35'; +our $VERSION = '0.36'; use Storable qw(dclone); @@ -467,14 +467,15 @@ sub _read_table ($;$) { my ($start, $end, $value) = / ^ (.+?) \t (.*?) \t (.+?) \s* ( \# .* )? # Optional comment $ /x; - $end = $start if $end eq ""; + my $decimal_start = hex $start; + my $decimal_end = ($end eq "") ? $decimal_start : hex $end; if ($return_hash) { - foreach my $i (hex $start .. hex $end) { + foreach my $i ($decimal_start .. $decimal_end) { $return{$i} = $value; } } else { - push @return, [ hex $start, hex $end, $value ]; + push @return, [ $decimal_start, $decimal_end, $value ]; } } return ($return_hash) ? %return : @return; |