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
KALYAN ACHARJYA 2019 年 5 月 10 日
Read here about rem, bitshift and bitxor or any specifc line?

サインインしてコメントする。

回答 (0 件)

カテゴリ

タグ

質問済み:

2019 年 5 月 10 日

コメント済み:

2019 年 5 月 10 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by