bitand

Navigation:  Language Reference > Operators > Binary >

bitand

Previous pageReturn to chapter overviewNext page

Syntax

y = a bitand b

Description

a bitand b performs a bitwise AND between a and b. Both a and b are treated as 32-bit (4-byte) integer values, so an eventual fraction will be ignored.

Example

In 20-sim, all bitwise function arguments are treated as 32-bit integers. Thus the binary representation of 30 (ignoring leading zeroes) is equal to 11110 as shown in the figure below. Similarly, the binary representation of 9 is 1001. The binary value of 30 bitand 9 is equal to 01000, which corresponds with decimal value of 8.

 

 

Bitoperators

Limitations

a and b must be integers.