faster implementation of addr_in_subnet()