[lib] Optimise owl_mac_equals()

MAC addresses are more likely to vary in the right octets than in the
left octets, so we compare them starting from the end rather than from
the beginning.
This commit is contained in:
Matteo Cypriani 2012-05-25 12:23:06 +02:00
parent 316db76861
commit b594505ea7
1 changed files with 1 additions and 1 deletions

View File

@ -68,7 +68,7 @@ owl_bool owl_mac_equals(const uint8_t *const mac1,
const uint8_t *const mac2)
{
int i ;
for (i = 0 ; i < ETHER_ADDR_LEN ; ++i)
for (i = ETHER_ADDR_LEN - 1 ; i >= 0 ; --i)
if(mac1[i] != mac2[i])
return owl_false ;
return owl_true ;