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

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

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