GLBasic User Manual

Main sections

ASR()

res% = ASR(num%, shift%)



Shifts the binary bits of an integer number right by shift% number of bits. Each bit shift to the right halves num%.

a% = 3
b% = 256
a% = ASL(a%, 3) // a=a*8
b% = ASR(b%, 4) // b=b/16
PRINT "a = " + a%,0,0
PRINT "b = " + b%,0,10
SHOWSCREEN
MOUSEWAIT


Output
A = 24
B = 16

See also...