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

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

%% 
% MATLAB(R) encodes negative integers using two's complement. Thus, the
% bit-wise OR of -5 (|11111010|) and 6 (|00000110|) is -1 (|11111110|).
C = -5;
D = 6;
bitor(C,D,'int8')