crenz has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to fix a bug in Audio::OSC, where values are packed/unpacked incorrectly on some platforms and I've run into a problem I can't really solve:
According to the OSC Spec examples, a float value of 440.0 should be encoded as 43 dc 00 00. Using pack('f', 440.0'), I get these results:
A user suggested the somewhat unsightly combination pack("N", unpack("l", pack("f", 440.0))), but that yielded
Can somebody help me to come up with a good and fast solution for this? Even if it only works on PCs, it's okay -- I can check the endian-ness on startup and make aliases for the correct function to use. The main point is that it should be correct and fast.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Stumped by a pack/unpack problem
by brian_d_foy (Abbot) on Feb 22, 2005 at 04:51 UTC | |
|
Re: Stumped by a pack/unpack problem
by esskar (Deacon) on Feb 22, 2005 at 00:26 UTC | |
by crenz (Priest) on Feb 22, 2005 at 08:14 UTC | |
by esskar (Deacon) on Feb 22, 2005 at 09:40 UTC | |
by jmcnamara (Monsignor) on Feb 23, 2005 at 11:54 UTC | |
|
Re: Stumped by a pack/unpack problem
by Aristotle (Chancellor) on Feb 23, 2005 at 11:26 UTC |