diff options
author | B. Watson <yalhcru@gmail.com> | 2016-01-20 23:46:17 -0500 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2016-01-20 23:46:17 -0500 |
commit | 9d032c9a1c0eca663c6877f5421957f50cb1eb79 (patch) | |
tree | 3626b074e0beece467318f41d35d42cb146d57e0 /titlecomp.pl | |
parent | 8aec40856588437a20906a0820941382475344ec (diff) | |
download | taipan-9d032c9a1c0eca663c6877f5421957f50cb1eb79.tar.gz |
rewrite sound code in asm, shed 186 bytes
Diffstat (limited to 'titlecomp.pl')
-rw-r--r-- | titlecomp.pl | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/titlecomp.pl b/titlecomp.pl index 58ce0d3..a62b715 100644 --- a/titlecomp.pl +++ b/titlecomp.pl @@ -16,11 +16,31 @@ for(split //, $data) { } $firstcode = shift || 128; # must be >=128 +if($firstcode eq '-l') { + $list_codes = 1; + $firstcode = 128; + $tabsize = shift || 25; +} + for($firstcode..255) { push @available_codes, $_ unless $got{$_}; } print scalar keys %got, " unique byte values\n"; print scalar @available_codes . " available run codes >= $firstcode\n"; +if($list_codes) { + $lowest = 256; + $best = 0; +# print join("\t", @available_codes) . "\n"; + for($i = 0; $i < @available_codes - $tabsize - 1; $i++) { + $used = $available_codes[$i + $tabsize - 1] - $available_codes[$i] + 1; + if($used < $lowest) { + $lowest = $used, $best = $available_codes[$i]; + } + print $available_codes[$i] . " " . $used . "\n"; + } + print "== optimum firstcode value is $best\n"; + exit(0); +} sub allocate_code { if(!@available_codes) { |