mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 09:41:54 +00:00
ABS should be a macro.
This commit is contained in:
parent
7d875e094b
commit
47f18ac39a
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#define MIN(a,b) (((a)<(b))?(a):(b))
|
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||||
#define MAX(a,b) (((a)>(b))?(a):(b))
|
#define MAX(a,b) (((a)>(b))?(a):(b))
|
||||||
|
#define ABS(a) ((a)>=0 ? (a) : -(a))
|
||||||
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(*(a)))
|
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(*(a)))
|
||||||
|
|
||||||
#ifndef NULL
|
#ifndef NULL
|
||||||
|
@ -399,7 +399,7 @@ lsa_comp(struct ospf_lsa_header *l1, struct ospf_lsa_header *l2)
|
|||||||
if((l1->age==LSA_MAXAGE)&&(l2->age!=LSA_MAXAGE)) return CMP_NEWER;
|
if((l1->age==LSA_MAXAGE)&&(l2->age!=LSA_MAXAGE)) return CMP_NEWER;
|
||||||
if((l2->age==LSA_MAXAGE)&&(l1->age!=LSA_MAXAGE)) return CMP_OLDER;
|
if((l2->age==LSA_MAXAGE)&&(l1->age!=LSA_MAXAGE)) return CMP_OLDER;
|
||||||
|
|
||||||
if(abs(l1->age-l2->age)>LSA_MAXAGEDIFF)
|
if(ABS(l1->age-l2->age)>LSA_MAXAGEDIFF)
|
||||||
return l1->age<l2->age ? CMP_NEWER : CMP_OLDER;
|
return l1->age<l2->age ? CMP_NEWER : CMP_OLDER;
|
||||||
|
|
||||||
return CMP_SAME;
|
return CMP_SAME;
|
||||||
|
Loading…
Reference in New Issue
Block a user