rem: } else { w *= 4; memcpy(d, s+tx*4, w);
context: RMakeTiledImage(RImage *tile, unsigned width, unsigned height){    int x, y;    unsigned w;    unsigned long tile_size = tile->width * tile->height;    unsigned long tx = 0;    RImage *image;    unsigned char *s, *d;    if (width == tile->width && height == tile->height)        image = RCloneImage(tile);    else if (width <= tile->width && height <= tile->height)        image = RGetSubImage(tile, 0, 0, width, height);    else {	int has_alpha = HAS_ALPHA(tile);        image = RCreateImage(width, height, has_alpha);        d = image->data;        s = tile->data;        for (y = 0; y < height; y++) {            for (x = 0; x < width; x += tile->width) {                w = (width - x < tile->width) ? width - x : tile->width;		if (has_alpha) {		    w *= 3;		    memcpy(d, s+tx*3, w);		} else {		    w *= 4;		    memcpy(d, s+tx*4, w);		}                d += w;            }	                tx = (tx + tile->width) % tile_size;        }    }    return image;}