Chapter-2/2-8/rightrot.c
/*rightrot:  rotates x to the right by n bit positions */
rotates x to the right by n bit positions
rotates x to the right by n bit positions
unsigned rightrot(unsigned x, unsigned n) {
  while (n > 0) {
    if (x & 1) 
      x = (x >> 1) | ~(~0U >> 1);
    else 
      x = x >> 1;
    --n;
  }
  return x;
}
unsigned rightrot ( unsigned x , unsigned n ) { while ( n > 0 ) { if ( x & 1 ) x = ( x >> 1 ) | ~ ( ~ 0U >> 1 ) ; else x = x >> 1 ; -- n ; } return x ; }
rightrot:  rotates x to the right by n bit positions
rightrot : rotates x to the right by n bit positions
/* rightmost bit of x is 1 */ /* rightmost bit of x is 0 */