chiark / gitweb /
bdfnorm: Improve performance, a bit
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 30 Apr 2016 14:31:55 +0000 (15:31 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 1 May 2016 11:41:28 +0000 (12:41 +0100)
bdfnorm

diff --git a/bdfnorm b/bdfnorm
index da20e76..87aed71 100755 (executable)
--- a/bdfnorm
+++ b/bdfnorm
@@ -39,7 +39,7 @@ while (<>) {
        chomp;
        m/[^0-9A-F]/ and die "$& ?";
 #      print "# $_\n";
-       s/./ unpack "B4", pack "H*", $& /ge;
+       $_ = unpack "B*", pack "H*", $_;
 #      print "# $_\n";
        $_ = ("0" x ($cbbox[2] - $fbbox[2])) . $_;
 #      print "# $_\n";
@@ -47,7 +47,7 @@ while (<>) {
 #      print "# $_\n";
        $_ .= "0" x ($numbytes*8 - length);
 #      print "# $_\n";
-       s/.{4}/ unpack "H", pack "B4", $& /ge;
+       $_ = unpack "H*", pack "B*", $_;
        $_ .= "\n";
     }
     print;