| **Navigation:**  [[introduction.htm|Language Reference]] > 13 - Built-in Functions >====== BSHIFT (return shifted bits) ====== | [[box draw a rectangle .htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[buffer set record paging .htm|{{btn_next_n.gif|Next page}}]] | | || **BSHIFT(**//value//,//count//**)** {{blk2blue.jpg|blk2blue.jpg}} | **BSHIFT** | Performs the bit shift operation. | | //value// | A numeric constant, variable, or expression. The //value// is converted to a LONG data type prior to the operation, if necessary. | | //count// | A numeric constant, variable, or expression for the number of bit positions to be shifted. If //count// is positive, //value// is shifted left. If //count// is negative, //value// is shifted right. | The **BSHIFT** procedure shifts a bit //value// by a bit //count//. The bit value may be shifted left (toward the high order), or right (toward the low order). Zero bits are supplied to fill vacated bit positions when shifting. | **Return Data Type:** | LONG | **Example:** ** !BSHIFT(0110b,1)   returns 1100b** ** !BSHIFT(0110b,-1)  returns 0011b** **Varswitch = ****BSHIFT****(20,3)         !Multiply by eight** **Varswitch = ****BSHIFT****(Varswitch,-2) !Divide by four** **See Also:** [[band return bitwise and .htm|BAND]] [[bor return bitwise or .htm|BOR]] [[bxor return bitwise exclusive or .htm|BXOR]]