- 论坛徽章:
- 145
|
回复 1# picbhan
It seems that can't use vec for your question because the BITS must be 1,2,4,8,16...
$ perldoc -f vec
vec EXPR,OFFSET,BITS
Treats the string in EXPR as a bit vector made up of elements
of width BITS, and returns the value of the element specified
by OFFSET as an unsigned integer. BITS therefore specifies the
number of bits that are reserved for each element in the bit
vector. This must be a power of two from 1 to 32 (or 64, if
your platform supports that).
If BITS is 8, "elements" coincide with bytes of the input
string.
If BITS is 16 or more, bytes of the input string are grouped
into chunks of size BITS/8, and each group is converted to a
number as with pack()/unpack() with big-endian formats "n"/"N"
(and analogously for BITS==64). See "pack" for details.
|
|