7 lines
256 B
Mathematica
Raw Normal View History

function Int32Out = Int8ToInt32(Int8In)
%% 8bit32bit
Int8In(Int8In<0) = Int8In(Int8In<0)+256;
tmp = reshape(Int8In,4,[]);
Int32Out = bitshift(tmp(1,:),0)+bitshift(tmp(2,:),8)+...
bitshift(tmp(3,:),16)+bitshift(tmp(4,:),24);
end