summaryrefslogtreecommitdiff
path: root/lib/prefix.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2018-10-25 20:24:25 +0000
committerQuentin Young <qlyoung@cumulusnetworks.com>2018-10-25 20:25:36 +0000
commit61be6e94ab21b6883884e3a6cbbfc5e4e1808bab (patch)
tree56e5fc84e650399c3a13328d8ac8dde056b99bd7 /lib/prefix.c
parentf93eee447e5664fa5cff99d9c07dab046d498749 (diff)
bgpd, lib: few more prefixlen updated
* Cast when assigning should be to uint16_t * Restored comment documenting strange behavior * Further increased PREFIX_STRLEN to 80 chars Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/prefix.c')
-rw-r--r--lib/prefix.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/prefix.c b/lib/prefix.c
index f3b707af3a..9f0aa50665 100644
--- a/lib/prefix.c
+++ b/lib/prefix.c
@@ -971,6 +971,10 @@ uint8_t ip_masklen(struct in_addr netmask)
{
uint32_t tmp = ~ntohl(netmask.s_addr);
+ /*
+ * clz: count leading zeroes. sadly, the behaviour of this builtin is
+ * undefined for a 0 argument, even though most CPUs give 32
+ */
return tmp ? __builtin_clz(tmp) : 32;
}