A newer version of Max is available. Click here to access the latest version of the documentation

& Reference

Bitwise intersection of two numbers

&

Description

Performs a bit-by-bit AND of two numbers as expressed in binary. Outputs a number composed of all those bits which are 1 in both of the two numbers.

Examples

Nonzero bits shared by both numbers........ Can be used as an odd/even detector

Arguments

initial-value [int]

Optional

Sets an initial value to be AND-ed with a number received in the left inlet.

Attributes

Common Box Attributes

Messages

bang

In left inlet: Performs the comparison with the numbers currently stored. If there is no argument, & initially holds 0 for comparison.

int

Arguments

input [int]
In left inlet: The number is compared, in binary form, with the number in the right inlet. The output is a number composed of those bits which are 1 in both numbers.

  (inlet1)

Arguments

comparison-number [int]
In right inlet: The number is stored for comparison with a number received in the left inlet.

float

Arguments

input [float]
Converted to int.

set

Arguments

set-input [int]
In left inlet: The word set followed by a number will set the input to the bitwise-and operation without causing output (a successive bang will output the result).

list

Arguments

input [number]
comparison-value [number]
In left inlet: Compares the first and second numbers bit-by-bit, and outputs a number composed of those bits which are 1 in both numbers.

Output

int

The two numbers received in the inlets are compared, one bit at a time. If a bit is 1 in both numbers, it will be 1 in the output number, otherwise it will be 0 in the output number.

See Also

Name Description
&&
|
||
Max Basic Tutorial 19: Timing Max Basic Tutorial 19: Timing