in reply to (tye)Re: 12 bit ints pairs into 3 bytes
in thread 12 bit ints pairs into 3 bytes
I thought about "L" and chop, but thought N might be more portable. And for unpack:if(defined($o)) { $o=substr(pack("N",$o | ($t{$string}<<12)),1,3); print F2 $o; undef $o; } else { $o=$t{$string}; }
$r=read(F1, $double, 3); ($double)=unpack(N,"\000$double"); $old_code=$double & 0xfff; $double >>= 12;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re: final decision: the whole cookie!
by tye (Sage) on Mar 03, 2001 at 11:51 UTC |