This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Generate $Config::Config{byteorder} slightly more efficiently.
authorNicholas Clark <nick@ccl4.org>
Thu, 25 Aug 2011 15:08:25 +0000 (17:08 +0200)
committerNicholas Clark <nick@ccl4.org>
Tue, 30 Aug 2011 10:16:17 +0000 (12:16 +0200)
configpm

index bea9ef5..33811ee 100755 (executable)
--- a/configpm
+++ b/configpm
@@ -412,13 +412,12 @@ my $f = $t eq 'long' ? 'L!' : $s == 8 ? 'Q': 'I';
 
 my $byteorder_code;
 if ($s == 4 || $s == 8) {
-    my $list = join ',', reverse(2..$s);
+    my $list = join ',', reverse(1..$s-1);
     my $format = 'a'x$s;
     $byteorder_code = <<"EOT";
 
-my \$i = 0;
-foreach my \$c ($list) { \$i |= ord(\$c); \$i <<= 8 }
-\$i |= ord(1);
+my \$i = ord($s);
+foreach my \$c ($list) { \$i <<= 8; \$i |= ord(\$c); }
 our \$byteorder = join('', unpack('$format', pack('$f', \$i)));
 EOT
 } else {