c
<     *outptr++ = colormap[0][t];
---
>     *outptr++ = colormap[0][t & (cmaplen - 1)];
