summaryrefslogtreecommitdiffstats
path: root/2/8.c
blob: 4ce829bafae5995361a65409047b112abfd9fbe7 (plain)
1
2
3
4
5
6
#include <stdio.h>

/* rotates x to the right by n positions */
unsigned rightrot(unsigned x, int n) {
    return (x >> n) | (x << (32 - n));
}