in reply to p0fq.pl and pack?
s, S and L use the system's endianness.
x86's s corresponds to universal v, with sign correction.
x86's S corresponds to universal v.
x86's L corresponds to universal V.
my $query = pack("L L L N N S S", ...);
should be
my $query = pack("V V V N N v v", ...);
... = unpack ("L L C Z20 Z40 c Z30 Z30 C C C s S N", $response);
should be
... = unpack ("V V C Z20 Z40 c Z30 Z30 C C C v v N", $response);
$score -= 65536 if $score > 32767;
$score -= 65536 if $score > 32767;
can also be written as
$score = unpack('s', pack('S', $score));
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: p0fq.pl and pack?
by Anonymous Monk on Feb 19, 2007 at 23:27 UTC | |
by ikegami (Patriarch) on Feb 20, 2007 at 02:19 UTC | |
by macli (Beadle) on Feb 20, 2007 at 03:40 UTC | |
by ikegami (Patriarch) on Feb 20, 2007 at 04:08 UTC | |
by macli (Beadle) on Feb 20, 2007 at 17:06 UTC | |
| |
by macli (Beadle) on Feb 20, 2007 at 03:12 UTC |