Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2407534f authored by Stephen Hemminger's avatar Stephen Hemminger Committed by Arnaldo Carvalho de Melo
Browse files

[ETHERNET]: Optimize is_broadcast_ether_addr



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: default avatarStephen Hemminger <shemminger@osdl.org>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@mandriva.com>
parent 450b5b18
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -71,8 +71,7 @@ static inline int is_multicast_ether_addr(const u8 *addr)


static inline int is_broadcast_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) &&  
	return (addr[0] & addr[1] & addr[2] & addr[3] & addr[4] & addr[5]) == 0xff;
		(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
}
}


/**
/**