BitAnd: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
(Fixed version) |
||
Line 1: | Line 1: | ||
{{Server client function}} | {{Server client function}} | ||
__NOTOC__ | __NOTOC__ | ||
{{New feature/item|3. | {{New feature/item|3.0132|1.3.2|5340| | ||
This function performs a bitwise AND-conjunction on two or more (unsigned) 32-bit [[Int|integers]]. See [http://en.wikipedia.org/wiki/Bitwise_operation#AND Bitwise operation] for more details. | This function performs a bitwise AND-conjunction on two or more (unsigned) 32-bit [[Int|integers]]. See [http://en.wikipedia.org/wiki/Bitwise_operation#AND Bitwise operation] for more details. | ||
}} | }} |
Latest revision as of 12:06, 2 June 2013
This function performs a bitwise AND-conjunction on two or more (unsigned) 32-bit integers. See Bitwise operation for more details.
Syntax
uint bitAnd ( uint var1, uint var2, ... )
Required arguments
- varN: The value you want to perform an AND-conjunction on
Returns
Returns the conjuncted value.
Example
local flags = 0x23 -- binary: 100011b local mask = 0x20 -- binary: 100000b -- Check if bit 1 is set if bitAnd(flags, mask) ~= 0 then outputDebugString"Yeah. It's set" else outputDebugString"I'm sorry ;(" end
To test if a flag is set or not it's easier using bitTest.