[Pixman] [PATCH] Faster C variant of over_n_8_8888 fast path

Siarhei Siamashka siarhei.siamashka at gmail.com
Mon Sep 13 16:10:22 PDT 2010


On Saturday 11 September 2010 15:31:10 Siarhei Siamashka wrote:
> +   else if (src >= (src << 8) && src >= (src << 16) && src >= (src << 24))
> +   {
> +  /* non-additive blending */

Sigh...

Somehow overlooked it, and the faster code path was actually not always taken 
when it could. This check should have been"if (src >= (src << 8) &&
(src | 0xFF0000) >= (src << 16) && src >= (src << 24))".

This can be verified by the following test program:
/**********/
#include <assert.h>
#include <stdint.h>

int main()
{
    uint32_t src;
    for (src = 0; src < 0xFFFFFFFF; src++)
    {
        int check1 = (src >= (src << 8) && (src | 0xFF0000) >= (src << 16) &&
                      src >= (src << 24));
        int check2 = ((src & 0xFF000000) >= ((src <<  8) & 0xFF000000) &&
                      (src & 0xFF000000) >= ((src << 16) & 0xFF000000) &&
                      (src & 0xFF000000) >= ((src << 24) & 0xFF000000));
        assert (check1 == check2);
    }
    return 0;
}
/**********/

-- 
Best regards,
Siarhei Siamashka
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/pixman/attachments/20100914/5f814666/attachment.pgp>


More information about the Pixman mailing list