
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FUNCky - <b>name:</b> <b>shl() - bitwise shift left of a number</b>
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Name: shl() - bitwise shift left of a number
Usage: shl(<int>,<number>)
Params: integer <int> - number to shift, not greater then 65535
integer <number> number of shifts, not greater than 255
Returns: integer equal to the bitwise shl of <int> and <number>
---------------------------------- Example ---------------------------------
? shl(8,1) && prints 16
? shl(8,2) && prints 32
? shl(15,3) && prints 30
? shl(245,8) && prints 0
Note: Shl()'ing one value with another will shift the bits
in <int> to the left the number of times specified
by <number>. If bit 7 is 1, then that bit drops off
the end. eg:
parameter = binary = dec
v1 = 10000110 = 134
v2 = 00000010 = 2
shl(v1,v2)= 00011000 = 24
You can use num2bin() and bin2num() to convert
binary strings into their decimal equivalents for ease
when using the binary functions.
See Also: and() or() rol() xor() test() shr() ror()
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson