if (npixels++ & 1) \
*op++ |= lastpixel; \
else \
- op[0] = lastpixel << 4; \
+ op[0] = (tidataval_t) (lastpixel << 4); \
}
static int
} else
lastpixel |= lastpixel << 4;
npixels += n;
- for (; n > 0; n -= 2)
- *op++ = lastpixel;
+ if (npixels < maxpixels) {
+ for (; n > 0; n -= 2)
+ *op++ = (tidataval_t) lastpixel;
+ }
if (n == -1)
*--op &= 0xf0;
lastpixel &= 0xf;