diff --git a/net/utils/net_ipv6_mask2pref.c b/net/utils/net_ipv6_mask2pref.c index 7800900d63..562fe40f12 100644 --- a/net/utils/net_ipv6_mask2pref.c +++ b/net/utils/net_ipv6_mask2pref.c @@ -39,9 +39,6 @@ #include -#include -#include - #include "utils/utils.h" #ifdef CONFIG_NET_IPv6 @@ -71,7 +68,7 @@ static const uint8_t g_nibblemap[16] = static inline uint8_t net_msbits4(uint8_t nibble) { - /* Return the number of leading zeroes: 0-4) */ + /* Return the number of leading ones: 0-4) */ return g_nibblemap[nibble]; } diff --git a/net/utils/net_ipv6_maskcmp.c b/net/utils/net_ipv6_maskcmp.c index 34d86e11ee..e8f7e007b6 100644 --- a/net/utils/net_ipv6_maskcmp.c +++ b/net/utils/net_ipv6_maskcmp.c @@ -41,8 +41,6 @@ #include -#include "utils/utils.h" - #ifdef CONFIG_NET_IPv6 /**************************************************************************** diff --git a/net/utils/net_ipv6_pref2mask.c b/net/utils/net_ipv6_pref2mask.c index 56dc44471a..f7521f6c12 100644 --- a/net/utils/net_ipv6_pref2mask.c +++ b/net/utils/net_ipv6_pref2mask.c @@ -101,12 +101,12 @@ void net_ipv6_pref2mask(uint8_t preflen, net_ipv6addr_t mask) else { /* Eg. preflen = 38, bit = {32} - * bit - preflen = 6 + * preflen - bit = 6 * mask = 0xffff << (16-6) * = 0xfc00 */ - mask[i] = 0xffff << (16 - (bit - preflen)); + mask[i] = 0xffff << (16 - (preflen - bit)); } } else