diff options
author | Chris Hall (GMCH) <chris.hall@highwayman.com> | 2009-12-09 19:56:24 +0000 |
---|---|---|
committer | Chris Hall (GMCH) <chris.hall@highwayman.com> | 2009-12-09 19:56:24 +0000 |
commit | 78cfba33568916dc861b37b771c2a261f67fffdd (patch) | |
tree | e7c25318f5a09905d04fb23447727da1e72a9074 /lib/prefix.h | |
parent | 5e4383cc008567bbb590031b920482e6f3a1dce9 (diff) | |
parent | cc2dd9280c4456586080d1cf4537d26c02fa9a36 (diff) | |
download | quagga-78cfba33568916dc861b37b771c2a261f67fffdd.tar.bz2 quagga-78cfba33568916dc861b37b771c2a261f67fffdd.tar.xz |
Merge remote branch 'quagga/master' of /git/quagga.euro-ix into pthreads
Diffstat (limited to 'lib/prefix.h')
-rw-r--r-- | lib/prefix.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/prefix.h b/lib/prefix.h index 9cfc1556..d3707209 100644 --- a/lib/prefix.h +++ b/lib/prefix.h @@ -127,6 +127,16 @@ struct prefix_rd /* Prefix's family member. */ #define PREFIX_FAMILY(p) ((p)->family) +/* Check bit of the prefix. */ +static inline unsigned int +prefix_bit (const u_char *prefix, const u_char prefixlen) +{ + unsigned int offset = prefixlen / 8; + unsigned int shift = 7 - (prefixlen % 8); + + return (prefix[offset] >> shift) & 1; +} + /* Prototypes. */ extern int afi2family (int); extern int family2afi (int); |