On Wednesday 2008-03-26 11:28, Michał Mirosław wrote:
On Wed, Mar 26, 2008 at 08:44:20AM +0100, Jan Engelhardt wrote:
+ return htonl(ntohl(a) & ~(~(u_int32_t)0 >> l));
BTW, isn't this way faster:
return a & htonl(~(~(u_int32_t)0 >> l));
Faster (and safe) is, and it was part of a previously suggested patches,
static inline __be32 maskl(__be32 a, unsigned int l)
{
return a & prefixlen_netmask_map[l].ip;
}
where prefixlen_netmask_map is a precomputed list of mask addresses.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html