Blob.Rotate

Parent Previous Next

Blob.Rotate.

Returns a blob of the same length where the bytes and bits are repositioned to the left or right. Please view the example at the end of this page.


When doing a rotation not a single bit is lost - it is just repositioned. The blob is considered "virtually circular" - meaning that bits shifted out at one end - are shifted back in at the other end.


Syntax.


 Rotate(Integer bytesLeft, bitsLeft) : Blob

 


Arguments:


Example:


 Blob b := (0x00AAFF).Rotate(1,-1); //Now b == 0x557F80;


 //Calculation:

 //             byte0       byte1        byte2

 //0x00AAFF ~ 0000 0000 , 1010 1010 , 1111 1111

 //           --------------------------------- 1 byte left

 //           1010 1010 , 1111 1111 , 0000 0000

 //           --------------------------------- 1 bit right

 //0x557F80   0101 0101 , 0111 1111 , 1000 0000

 //============================================