QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

The _SHR function is used to shift the bits of a numerical value to the right.

Syntax

result = _SHR(numericalVariable, numericalValue)

Parameter(s)

Description

Availability

Example(s)


A~%% = 128 'set left most bit of an_UNSIGNED _BYTE
PRINT A~%%
PRINT _SHR(A~%%,7)
PRINT _SHR(A~%%,8) 'shift the bit off the right 'edge'


 128
 1
 0


A~%% = 128
FOR I%% = 0 TO 8
    PRINT _SHR(A~%%, I%%)
NEXT I%%


 128
  64
  32
  16
  8
  4
  2
  1
  0

See Also