good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Can unpack add zero bytes before converting?by mossi2000 (Initiate) |
on Sep 12, 2021 at 13:29 UTC ( [id://11136689]=perlquestion: print w/replies, xml ) | Need Help?? |
mossi2000 has asked for the wisdom of the Perl Monks concerning the following question:
Hi monks, I'm using Perl to parse the byte stream output of a hardware. Depending on the HW configuration I get a stream of data consisting of 40, 48, 56 or 64 bits litle-endian. In principle the lower 5,6,7 or the complete 8 byte of a 64bit litle-endian integer. I was trying to convert this data using unpack but whatever I tried using 'x' or '@' I did not succeed in (p)adding the missing 0 bytes before converting to a 64bit integer. (I'm using a Perl with support for 64bit integers) My current solution looks like: (using bitstrings..)
My question: Axel
Back to
Seekers of Perl Wisdom
|
|