function for bit rotation
显示 更早的评论
anybody help me to explain following bit rotation function :
function[data,nBits]=bit_rotate(data,nBits)
dataBits=log2(double(intmax(class(data)))+1);
nBits=rem(nBits,dataBits);
if nBits==0
return
end
shiftedData=bitshift(data,nBits);
lostData=bitxor(data,bitshift(shiftedData,-nBits));
rotatedData=bitshift(lostData,nBits-sign(nBits)*dataBits);
data=shiftedData + rotatedData;
end
1 个评论
KALYAN ACHARJYA
2019-5-10
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Assembly 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!