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. InputsAandBmust either be the same size or have sizes that are compatible (for example,Ais anM-by-Nmatrix andBis a scalar or1-by-Nrow vector). For more information, seeCompatible Array Sizes for Basic Operations.AandBalso must be the same data type unless one is a scalar double.
IfAandB双阵列,assumedtypeis not specified, then MATLAB®treatsAandBas unsigned 64-bit integers.
Ifassumedtypeis specified, then all elements inAandBmust have integer values within the range ofassumedtype.
Data Types:double|logical|int8|int16|int32|int64|uint8|uint16|uint32|uint64
assumedtype—Assumed data type ofinteg1andinteg2 'uint64'|'uint32'|'uint16'|“uint8'|'int64'|'int32'|'int16'|'int8'
Assumed data type ofAandB, specified as'uint64','uint32','uint16',“uint8','int64','int32','int16', or'int8'.
IfAandBare double arrays, thenassumedtypecan specify any valid integer type, but defaults to'uint64'.
IfAandBare integer type arrays, thenassumedtypemust specify that same integer type.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.