[PATCH] xkb: Replace a few manual bitflips with SetBit & friends.

Peter Hutterer peter.hutterer at who-t.net
Wed Jan 12 19:19:39 PST 2011


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---

no functional changes, but readability++.

 xkb/XKBMisc.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/xkb/XKBMisc.c b/xkb/XKBMisc.c
index efe2911..96688be 100644
--- a/xkb/XKBMisc.c
+++ b/xkb/XKBMisc.c
@@ -454,11 +454,12 @@ unsigned		changed,tmp;
 	    }
 	    if (((explicit&XkbExplicitAutoRepeatMask)==0)&&(xkb->ctrls)) {
 		CARD8 old;
-		old= xkb->ctrls->per_key_repeat[key/8];
+		old= BitIsOn(xkb->ctrls->per_key_repeat, key);
 		if (interps[0]->flags&XkbSI_AutoRepeat)
-		     xkb->ctrls->per_key_repeat[key/8]|= (1<<(key%8));
-		else xkb->ctrls->per_key_repeat[key/8]&= ~(1<<(key%8));
-		if (changes && (old!=xkb->ctrls->per_key_repeat[key/8]))
+		    SetBit(xkb->ctrls->per_key_repeat, key);
+		else
+		    ClearBit(xkb->ctrls->per_key_repeat, key);
+		if (changes && old != BitIsOn(xkb->ctrls->per_key_repeat, key))
 		    changes->ctrls.changed_ctrls|= XkbPerKeyRepeatMask;
 	    }
 	}
@@ -466,9 +467,9 @@ unsigned		changed,tmp;
     if ((!found)||(interps[0]==NULL)) {
 	if (((explicit&XkbExplicitAutoRepeatMask)==0)&&(xkb->ctrls)) {
 	    CARD8 old;
-	    old= xkb->ctrls->per_key_repeat[key/8];
-            xkb->ctrls->per_key_repeat[key/8]|= (1<<(key%8));
-	    if (changes && (old!=xkb->ctrls->per_key_repeat[key/8]))
+	    old = BitIsOn(xkb->ctrls->per_key_repeat, key);
+	    SetBit(xkb->ctrls->per_key_repeat, key);
+	    if (changes && (old != BitIsOn(xkb->ctrls->per_key_repeat, key)))
 		changes->ctrls.changed_ctrls|= XkbPerKeyRepeatMask;
 	}
 	if (((explicit&XkbExplicitBehaviorMask)==0)&&
-- 
1.7.3.4



More information about the xorg-devel mailing list