Core Function BitOR
From Sputnik Wiki
(Difference between revisions)
(Created page with "<pre> BitOR( <expression>, <expression2>, <n> ) </pre> === Description === Performs a bitwise OR operation. === Parameters === ==== expression ==== The first number. ==== e...") |
(→n) |
||
Line 19: | Line 19: | ||
==== n ==== | ==== n ==== | ||
− | Optional; The nth number - | + | Optional; The nth number - no limit to number of values that can be specified. |
=== Return Value === | === Return Value === |
Revision as of 09:42, 20 October 2013
BitOR( <expression>, <expression2>, <n> )
Contents |
Description
Performs a bitwise OR operation.
Parameters
expression
The first number.
expression2
The second number.
n
Optional; The nth number - no limit to number of values that can be specified.
Return Value
Returns the two parameters bitwise-OR'ed together.
Remarks
Remember hex notation can be used for numbers.
Remember that OR returns 0 if both bits are 0 and returns 1 otherwise.
Some might wonder the point of such a function when clear | operators exist but why not!.
Example
$x = BitOR(3, 6); println($x); // x == is 7 because 0011 OR 0110 = 0111 $x = BitOR(3, 15, 32); println($x); //x == 47 because 0011 OR 1111 OR 00100000 = 00101111 // Another method $x = 3 | 7; println($x); $x = 3 | 15 | 32; println($x);