mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-26 20:20:53 +03:00
ip2net: fix ipv4 mask for /0
This commit is contained in:
parent
df8bef2a77
commit
fa236ecc2c
@ -49,7 +49,7 @@ static int ucmp(const void * a, const void * b, void *arg)
|
|||||||
}
|
}
|
||||||
static uint32_t mask_from_bitcount(uint32_t zct)
|
static uint32_t mask_from_bitcount(uint32_t zct)
|
||||||
{
|
{
|
||||||
return ~((1 << zct) - 1);
|
return zct<32 ? ~((1 << zct) - 1) : 0;
|
||||||
}
|
}
|
||||||
// make presorted array unique. return number of unique items.
|
// make presorted array unique. return number of unique items.
|
||||||
// 1,1,2,3,3,0,0,0 (ct=8) => 1,2,3,0 (ct=4)
|
// 1,1,2,3,3,0,0,0 (ct=8) => 1,2,3,0 (ct=4)
|
||||||
|
Loading…
Reference in New Issue
Block a user