Exercise 2-8.Write a function rightrot(x,n) that returns the value of the integer x rotated
to the right b y npositions.
int unsignedLength()
{
unsigned x = (unsigned)~0;
int i = 0;
while (x != 0)
{
x = x >> 1;
i++;
}
return i;
}
unsigned rightrot(unsigned x, int n)
{
int l = unsignedLength();
int a, b, c;
a = (~0) >> (l - n) | x;
b = x >> n;
c = a << (l - n);
return b | c;
}