]> err.no Git - linux-2.6/commitdiff
[ETHERNET]: Optimize is_broadcast_ether_addr
authorStephen Hemminger <shemminger@osdl.org>
Wed, 2 Nov 2005 00:52:11 +0000 (16:52 -0800)
committerArnaldo Carvalho de Melo <acme@mandriva.com>
Wed, 2 Nov 2005 23:54:07 +0000 (21:54 -0200)
Optimize the match for broadcast address by using bit operations instead
of comparison. This saves a number of conditional branches, and generates
smaller code.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
include/linux/etherdevice.h

index cc84934f90591a6d6020d2d3bcc2e874433621bb..17460c85df7b843e5b83fe3811bef33cbb45e5cc 100644 (file)
@@ -71,8 +71,7 @@ static inline int is_multicast_ether_addr(const u8 *addr)
 
 static inline int is_broadcast_ether_addr(const u8 *addr)
 {
-        return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) &&  
-               (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
+       return (addr[0] & addr[1] & addr[2] & addr[3] & addr[4] & addr[5]) == 0xff;
 }
 
 /**