function for bit rotation
Mostra commenti meno recenti
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 Commento
KALYAN ACHARJYA
il 10 Mag 2019
Risposte (0)
Categorie
Scopri di più su Assembly in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!