<ident> = <blob>.bitswap({<range> ,...})
or
<blob>.bitswap({<range> ,...})
blob or procedure
A function which re-orders (bit-swaps) bits within bytes of the blob.
If called as part of a blob assignment or expression, the return value of this function is a copy of the blob with the relevant bits re-ordered. The whole blob is returned, not just the bytes which have been bit-swapped. The original blob is left unchanged.
If called stand-alone, there is no return value but the blob has the bits re-ordered in place.
Bit-swapping a byte just reverses the order of its bit values, e.g. 10000000 becomes 00000001.
The parameters to this function are one or more byte ranges. Each range is in the form startbyte:endbyte or just byte if only one byte is required. The ranges are comma-separated and do not have to be consecutive in byte order. Omitting the range parameters implies that all byte values are to be bit-swapped.
The code of this function cannot be redefined.
Swap the order of all bits in a blob:
myblob.bitswap()
Swap the bit-order of a range of bytes (5 bytes in fact), and return the result into another blob:
blob newblob = myblob.bitswap(25:29)
Commands: |
|
Structures: |