lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed,  3 Jan 2007 19:05:12 +0100 (CET)
From:	Jiri Benc <jbenc@...e.cz>
To:	"John W. Linville" <linville@...driver.com>
Cc:	netdev@...r.kernel.org
Subject: [PATCH 4/12] d80211: simplify classify_1d

The switch in classify_1d can be simplified to a bit operation.

Signed-off-by: Jiri Benc <jbenc@...e.cz>

---

 net/d80211/wme.c |   19 ++-----------------
 1 files changed, 2 insertions(+), 17 deletions(-)

e874890656210a235fbcfe0935717f86e5d179d9
diff --git a/net/d80211/wme.c b/net/d80211/wme.c
index f26fe6c..0624ad8 100644
--- a/net/d80211/wme.c
+++ b/net/d80211/wme.c
@@ -129,24 +129,9 @@ #endif /* CONFIG_NET_SCHED */
 	ip = (struct iphdr *) (skb->data + offset);
 
 	dscp = ip->tos & 0xfc;
-	switch (dscp) {
-	case 0x20:
-		return 1;
-	case 0x40:
-		return 2;
-	case 0x60:
-		return 3;
-	case 0x80:
-		return 4;
-	case 0xa0:
-		return 5;
-	case 0xc0:
-		return 6;
-	case 0xe0:
-		return 7;
-	default:
+	if (dscp & 0x1c)
 		return 0;
-	}
+	return dscp >> 5;
 }
 
 
-- 
1.3.0

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists