kernel32: Add a couple of weird PE images

Michael Jung mjung at iss.tu-darmstadt.de
Wed Dec 13 14:46:07 CST 2006


On Wednesday 13 December 2006 18:00, Dmitry Timoshkov wrote:
> +static BOOL is_power_of_two(DWORD alignment)
> +{
> +    if (!alignment) return FALSE;
> +
> +    while (!(alignment & 1))
> +    {
> +        alignment >>= 1;
> +    }
> +    return alignment == 1;
> +}

Although speed should not be an issue here, a faster way to test for a power 
of two is:

alignment && !(alignment & (alignment-1))

Bye,
-- 
Michael Jung
mjung at iss.tu-darmstadt.de



More information about the wine-devel mailing list