in reply to Re^2: Efficient 7bit compression
in thread Efficient 7bit compression
sub shrink { my $packed = ''; while ($_[0] =~ /(.{1,8})/gs) { my $bitstr = unpack('B*', $1); $bitstr =~ s/.(.{7})/$1/g; $packed .= pack('B*', $bitstr); } $packed; } sub grow { my $unpacked = ''; while ($_[0] =~ /(.{1,7})/gs) { my $bitstr = unpack('B*', $1); $bitstr =~ s/(.{7})/0$1/g; $unpacked .= pack('B*', $bitstr); } $unpacked; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Efficient 7bit compression
by Limbic~Region (Chancellor) on Mar 14, 2005 at 16:14 UTC | |
by Roy Johnson (Monsignor) on Mar 14, 2005 at 16:36 UTC | |
by Limbic~Region (Chancellor) on Mar 14, 2005 at 16:43 UTC | |
by Roy Johnson (Monsignor) on Mar 14, 2005 at 18:15 UTC |