[2/2] iphlpapi: Use the new version of the IP_ADAPTER_UNICAST_ADDRESS structure (try 2)

Hans Leidekker hans at codeweavers.com
Fri Jan 13 09:01:41 CST 2017


On Fri, 2017-01-13 at 15:52 +0100, André Hentschel wrote:
> >> Please add a helper to compute prefix length instead of duplicating this code.
> >> This should probably wait until the code freeze is over.
> >>
> > For what it's worth, if you're adding a helper function anyway, note
> > that you're really just counting the number of trailing zero-bits. GCC
> > has __builtin_ctz() for that, but even without that there are better
> > approaches than testing each bit individually. Alternatively, there's
> > also __builtin_popcount().
> > 
> 
> Thank you both for the hints.
> One thing is that popcount would count all 1s even with 0s in between, whereas this function stops at the first 0.
> Hans, you wrote it that way, there's no checking if the mask is mangled (0s in between), how should it react to mangled masks?

I think we should just trust the OS to give us a valid mask.





More information about the wine-devel mailing list