51 unsigned addr_byte_count,
52 unsigned network_bits)
56 if (network_bits > addr_byte_count * CHAR_BIT)
57 msg_panic(
"mask_addr: address byte count %d too small for bit count %d",
58 addr_byte_count, network_bits);
60 p = addr_bytes + network_bits / CHAR_BIT;
61 network_bits %= CHAR_BIT;
63 if (network_bits != 0)
64 *p++ &= ~0U << (CHAR_BIT - network_bits);
66 while (p < addr_bytes + addr_byte_count)
void mask_addr(unsigned char *addr_bytes, unsigned addr_byte_count, unsigned network_bits)
NORETURN msg_panic(const char *fmt,...)