forked from livecode/livecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbitAnd.lcdoc
More file actions
50 lines (32 loc) · 1.26 KB
/
bitAnd.lcdoc
File metadata and controls
50 lines (32 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Name: bitAnd
Type: operator
Syntax: <number1> bitAnd <number2>
Summary:
Performs a "bitwise and" <operation> on the <binary> representation of
two numbers.
Introduced: 1.0
OS: mac, windows, linux, ios, android
Platforms: desktop, server, mobile
Example:
0 bitAnd 1 -- evaluates to 0
Example:
3 bitAnd 2 -- in binary: 11 bitAnd 10; evaluates to 10; converted to 2
Parameters:
number1:
The number1 and number2 are numbers, or expressions that evaluate to
numbers, between zero and 4,294,967,295 (2^32 - 1).
number2:
Description:
Use the <bitAnd> <operator> to operate directly on the <bit|bits> of two
numbers.
To perform the <bitAnd> <operation>, LiveCode first converts both
<operand|operands> to their <binary> equivalent, a string of ones and
zeroes. 1 is equivalent to true, and 0 is equivalent to false.
For each bit of <number1>, LiveCode performs an <and> <operation> with
the corresponding <bit> of <number2> to produce a result. A <bit> is 1
if the corresponding <bit|bits> of <number1> and <number2> are both 1.
Otherwise, the <bit> is 0.
Finally, the binary number thus created is converted back to decimal.
References: operation (glossary), operator (glossary), bit (glossary),
binary (glossary), operand (glossary), and (operator), bitNot (operator)
Tags: math