3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 21:22:37 +01:00

utils: Add util_netmask_from_prefix

This commit is contained in:
Andrew Zaborowski 2021-02-26 17:17:25 +01:00 committed by Denis Kenzior
parent b689100c1c
commit e714e72e05

View File

@ -110,4 +110,9 @@ static inline uint32_t util_secure_fill_with_msb(uint32_t val)
bool util_ip_prefix_tohl(const char *ip, uint8_t *prefix, uint32_t *start_out, bool util_ip_prefix_tohl(const char *ip, uint8_t *prefix, uint32_t *start_out,
uint32_t *end_out, uint32_t *mask_out); uint32_t *end_out, uint32_t *mask_out);
static inline uint32_t util_netmask_from_prefix(uint8_t prefix_len)
{
return ~((1ull << (32 - prefix_len)) - 1);
}
#endif /* __UTIL_H */ #endif /* __UTIL_H */