MATLAB® encodes negative integers using two's complement. For example, to find the two's complement representation of -5, you take the bit pattern of the positive version of the number (00000101), swap each bit (11111010), and then add 1 to the result (11111011).
Therefore, the bit-wise AND of -5 (11111011) and 6 (00000110) is 2 (00000010).
Input values, specified as scalars, vectors, matrices, or multidimensional
arrays. Inputs A and B must
either be the same size or have sizes that are compatible (for example, A is
an M-by-N matrix and B is
a scalar or 1-by-N row vector).
For more information, see Compatible Array Sizes for Basic Operations. A and B also
must be the same data type unless one is a scalar double.
If A and B are
double arrays, and assumedtype is not specified,
then MATLAB® treats A and B as
unsigned 64-bit integers.
If assumedtype is specified, then
all elements in A and B must
have integer values within the range of assumedtype.