Posts: 843
Threads: 60
Joined: Mar 2003
what do these do?
no offense wt, but im kinda tired of looking at the wikis you post. i would just like a simple explanation this time. :wink:
Posts: 38
Threads: 1
Joined: Aug 2005
SHL = SHift Left
SHR = SHift Right
Shifts an integral number by a given number of bits.
Example:
Code:
print 1 shl 4 ' outputs 16
'x SHL y' is mathematically the same as 'x * 2 ^ y' for every y>=0 and 'x SHR y' is mathematically the same as 'fix(x / 2 ^ y)' for every y>=0.
Regards,
Mark
Posts: 1,025
Threads: 44
Joined: May 2005
Visual representation
2:
00000000 00000000 00000000 00000010
2 shl 1:
00000000 00000000 00000000 00000100
2 shr 1:
00000000 00000000 00000000 00000001
edit: assuming a 32 bit number is used
Posts: 843
Threads: 60
Joined: Mar 2003
Thank u mjs and deleter for that quick as hell explanation.
cross my heart.
Posts: 1,025
Threads: 44
Joined: May 2005
np, hope all works out well