On Mon, Aug 08, 2016 at 08:53:16PM +0200, Jiri Kosina wrote:
> Ville's patch is the proper thing to do; I still think the comments 
> probably should be removed as they might provide more confusion than help, 
> but that's a separate discussion.

Right, so while trying to debug this with a pen and paper, I found that
adding a subsript to the w variable makes it more understandable. I.e.,
something like this:

        w_1 -= (w >> 1) & 0x55555555;
        w_2 =  (w_1 & 0x33333333) + ((w_1 >> 2) & 0x33333333);

and then you'd have

        movl %eax, %edx                         # w
        shrl %edx                               # w >>= 1
        andl $0x55555555, %edx                  # (w >> 1) & 0x55555555
        subl %edx, %eax                         # w_1 = w - ...

        movl %eax, %edx                         # w_1
        shrl $2, %eax                           # w_1 >>= 2
        andl $0x33333333, %edx                  # (w_1 >> 2) & 0x33333333
        andl $0x33333333, %eax                  # w_1 &= 0x33333333
        addl %edx, %eax                         # w_2 = ... + ...

...

Anyway, something like that. I find that more readable TBH.

Thanks and thanks for confirming Ville's patch fixes it on your box.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--

Reply via email to