jhanna has asked for the wisdom of the Perl Monks concerning the following question:
and then to read:sub c_out { my $_=shift; my $final=shift; if(defined($c_out_store)) { print F2 pack('H*',sprintf('%03x%03x',$_,$c_out_store)); undef $c_out_store; } elsif($final) { print F2 pack('H*',sprintf('%03x%03x',0,$_)); } else { $c_out_store=$_; } }
while($usedouble || !eof($file_in)) { if($usedouble) { $new_code=$double; $usedouble=0; } else { $r=read($file_in, $double, 3); ($double)=unpack(N,"\000$double"); $new_code=$double & 0xfff; $double >>= 12; $usedouble=1; } # etc }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re: 12 bit ints pairs into 3 bytes
by tye (Sage) on Mar 01, 2001 at 03:18 UTC | |
by jhanna (Scribe) on Mar 01, 2001 at 03:33 UTC | |
by tye (Sage) on Mar 01, 2001 at 04:03 UTC | |
by jhanna (Scribe) on Mar 01, 2001 at 04:56 UTC | |
by jhanna (Scribe) on Mar 03, 2001 at 04:38 UTC | |
by tye (Sage) on Mar 03, 2001 at 11:51 UTC |