From 6444a52582b3a463124394afc034b011b088850f Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Tue, 27 Jan 2015 03:33:59 -0500 Subject: [PATCH] avoid some unnecessary shifts --- libvips/foreign/openslide2vips.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/libvips/foreign/openslide2vips.c b/libvips/foreign/openslide2vips.c index 9ae7a58a..f6176be1 100644 --- a/libvips/foreign/openslide2vips.c +++ b/libvips/foreign/openslide2vips.c @@ -46,7 +46,7 @@ * 9/8/14 * - do argb -> rgba for associated as well * 27/1/15 - * - improve unpremultiplication performance for opaque pixels + * - unpremultiplication speedups for fully opaque/transparent pixels */ /* @@ -417,18 +417,12 @@ argb2rgba( uint32_t *buf, int n, uint32_t bg ) VipsPel *out = (VipsPel *) p; if( a == 255 ) { - out[0] = (x >> 16) & 255; - out[1] = (x >> 8) & 255; - out[2] = x & 255; - out[3] = 255; + *p = GUINT32_TO_BE((x << 8) | 255); } else if( a == 0 ) { /* Use background color. */ - out[0] = (bg >> 16) & 255; - out[1] = (bg >> 8) & 255; - out[2] = bg & 255; - out[3] = 255; + *p = GUINT32_TO_BE((bg << 8) | 255); } else { /* Undo premultiplication.