From a58b7433ba8a115117a23814f01a0563598a8b92 Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Tue, 8 Sep 2020 15:29:22 +0200 Subject: [PATCH] Fix wrong rotation direction --- dirot.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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;