XP_QSORT(ind, max_colors, sizeof(*ind), compare_uint32);
NS_QuickSort(ind, max_colors, sizeof(*ind), compare_uint32, NULL);
unique_map_colors(NI_ColorMap *cmap){    uint i;    uint32 ind[256];    int32 num_colors = cmap->num_colors;    IL_RGB *map = cmap->map;    uint max_colors;    uint unique_colors = 1;        /* A -ve value for cmap->num_colors indicates that the colors may be       non-unique. */    if (num_colors > 0)         /* Colors are unique. */        return;    max_colors = -num_colors;    PR_ASSERT(max_colors <= 256);    PR_ASSERT(map);    /* Convert RGB values into indices. */    for (i = 0; i < max_colors; i++) {        ind[i] = (map[i].red << 16) + (map[i].green << 8) + map[i].blue;    }    /* Sort by color, so identical colors will be grouped together. */    XP_QSORT(ind, max_colors, sizeof(*ind), compare_uint32);    /* Look for adjacent colors with different values */    for (i = 0; i < max_colors-1; i++)        if (ind[i] != ind[i + 1])            unique_colors++;    cmap->num_colors = unique_colors;}