Arithmetic coding/As a generalized change of radix: Difference between revisions

m
→‎{{header|Perl}}: minor code simplification
m (→‎{{header|Ruby}}: simplified the cumulative_freq() function)
m (→‎{{header|Perl}}: minor code simplification)
Line 225:
my %cf;
my $total = Math::BigInt->new(0);
foreach my $c (mapsort {keys chr } 0 .. 255%$freq) {
if (exists $freq->cf{$c}) {= $total;
$total += $cffreq->{$c} = $total;
$total += $freq->{$c};
}
}
 
2,747

edits