www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/NegativeValuesExample.m

    %% Negative Values  
% Explore how |bitand| handles negative values.  

%% 
% MATLAB(R) encodes signed integers using two's complement. Thus, the
% bit-wise AND of -5 (|11111011|) and 6 (|00000110|) is 2 (|00000010|).
C = -5;
D = 6;
bitand(C,D,'int8')