diff --git a/dirot.c b/dirot.c index bdb1246..9f3014d 100644 --- a/dirot.c +++ b/dirot.c @@ -12,11 +12,12 @@ void test_and_fail(void *ptr, char *msg) { } } -int ror4 (int x) { - // Just rotate right by 1 bit +int rol4 (int x) { + // Just rotate left by 1 bit int num = x & 0xf; - int lowbit = x & 0x1; - return (num >> 1) | (lowbit << 3); + int sh = num << 1; + int overflow = (sh & 0x10) >> 4; + return (sh & 0xf) | overflow; } int main (void) { @@ -33,7 +34,7 @@ int main (void) { Rotation all; all = XRRRotations(dpy, screen_number, ¤t); - Rotation new = ror4(current); + Rotation new = rol4(current); Time cfg_ts; Rotation cfg_rot;