Bit rotations exercise
Isn't it something like this?

#include &lt;limits.h&gt; /* for CHAR_BIT */

unsigned
rotate_right(unsigned x, int n)
{
    int left_shift = ((sizeof x) * CHAR_BIT) - n;
    return x&lt;&lt;left_shift | x&gt;&gt;n;
}