summaryrefslogtreecommitdiff
path: root/lib/prefix.c
diff options
context:
space:
mode:
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;
}