mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 07:48:07 +00:00
lib: prefix.c nano-optimisation
* lib/prefix.c: (prefix_match) nano-optimisation, let it return early without copying pointers.
This commit is contained in:
parent
3322055b39
commit
d358344759
@ -70,15 +70,16 @@ prefix_match (const struct prefix *n, const struct prefix *p)
|
|||||||
{
|
{
|
||||||
int offset;
|
int offset;
|
||||||
int shift;
|
int shift;
|
||||||
|
const u_char *np, *pp;
|
||||||
/* Set both prefix's head pointer. */
|
|
||||||
const u_char *np = (const u_char *)&n->u.prefix;
|
|
||||||
const u_char *pp = (const u_char *)&p->u.prefix;
|
|
||||||
|
|
||||||
/* If n's prefix is longer than p's one return 0. */
|
/* If n's prefix is longer than p's one return 0. */
|
||||||
if (n->prefixlen > p->prefixlen)
|
if (n->prefixlen > p->prefixlen)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
/* Set both prefix's head pointer. */
|
||||||
|
np = (const u_char *)&n->u.prefix;
|
||||||
|
pp = (const u_char *)&p->u.prefix;
|
||||||
|
|
||||||
offset = n->prefixlen / PNBBY;
|
offset = n->prefixlen / PNBBY;
|
||||||
shift = n->prefixlen % PNBBY;
|
shift = n->prefixlen % PNBBY;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user