I wouldn't run off to p5p just yet...but that's me, you may get better and/or quicker answers there from someone who has a 64-bit system to play with. That said, of you go there, do so via the perl5porters@perl.com list rather than perlbug as what my snippet did prove is that this isn't a perlbug. Your just using it wrong:)
One thing I notice is that you are attempting to pack a 16-bit numeric value by splitting it into two 8-bit values and using 'CC' and switching the bytes around to account for the endianess of the current system.
A) I think that you are doing this wrongly.
B) There is no need for you to do this sort of thing yourself. pack already has that smarts built-in, although it requires you to pass along some clue bats to enable it.
pack has format specifiers 'n' and 'v' which will pack a 16-bit unsigned value from a number in a perl scalar, in either big-endian or little-endian format respectively.
Also, you don't show where or how your $BIG_ENDIAN variable is being set, but you should take a look at the Config package which is a part of the standard distribution. In particular
use Config; print $Config{ byteorder };
will tell you the order of the bytes on the current system. It will probably return somethng like '12345678' or '78563412' on your system.
Hope this helps.
Update: You might also want to check out perlpacktut. It's about the best tutorial i've seen on pack. You may have a local copy, but it is fairly recent addition to the doc set,so the link above may help.
In reply to Re: Re: Re: Re: Re: 64 bit pointer to string
by BrowserUk
in thread 64 bit pointer to string
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |