I have a string of 0s and 1s, for instance "1101000010101111". I want to reverse each group of 8 chars in it. For the above example: "0000101111110101"
The application is a string of bits, and the bits of each byte must be reversed.
I'm looking for the fastest way to achieve this, on strings of small length (up to a few hundred chars). The obvius solution, which is pretty fast is with substr() on each 8 bits (in a for loop). Any better ideas ?
Thanks in advance
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |