SHRB - Shift right buffer

Language reference ›› Built-in procedures ›› Miscellaneous variable treatments ››
Parent Previous Next

SHRB(source, destination) NEW! (V2.0)        

Shift <destination> right by one position, inserting <source> to MSB.


Restrictions:


<destination> may be any variable of type CHAR, BYTE, WORD, LONGWORD, SHORTINT, INTEGER, LONGINT, or an ARRAY of these types, or an ARRAY of BOOLEAN; in this last case, the number of elements must be multiple of 8.


<source> may be any variable of type BOOLEAN, CHAR,  BYTE, WORD, LONGWORD, SHORTINT, INTEGER, LONGINT; if non-boolean, only the LSB will be moved (bit 0).


The variables cannot be pointers nor located in EEPROM.



VAR
 TheBit: BOOLEAN;
 TheBuf: ARRAY[1..5] OF BYTE;

 // Shift in the buffer to the right, insert into MSB
 SHRB(TheBit, TheBuf);


See also: SHRB function.