summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1999-04-12 22:26:06 +0200
committerMartin Mares <mj@ucw.cz>1999-04-12 22:26:06 +0200
commit2f5d154466e8d76f4054561a361bb45f157c29a6 (patch)
treef30b4c4498077235cd46e8b4a825e1789004f59a
parent38506f71b0bea5580987e999a7b1a69f58aec7ec (diff)
downloadbird-2f5d154466e8d76f4054561a361bb45f157c29a6.tar
bird-2f5d154466e8d76f4054561a361bb45f157c29a6.zip
Added ipa_compare as requested.
-rw-r--r--lib/ipv4.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/ipv4.h b/lib/ipv4.h
index d136536..a672036 100644
--- a/lib/ipv4.h
+++ b/lib/ipv4.h
@@ -56,6 +56,7 @@ typedef u32 ip_addr;
#define ipa_class_mask(x) x = _MI(ipv4_class_mask(_I(x)))
#define ipa_from_u32(x) _MI(x)
#define ipa_to_u32(x) _I(x)
+#define ipa_compare(x,y) ipv4_compare(_I(x),_I(y))
int ipv4_classify(u32);
u32 ipv4_class_mask(u32);
@@ -68,4 +69,9 @@ static inline unsigned ipv4_hash(u32 a)
return a & 0xffff;
}
+static inline int ipv4_compare(u32 x, u32 y)
+{
+ return (x > y) - (x < y);
+}
+
#endif