static void tight_palette_rgb2buf(uint32_t rgb, int bpp, uint8_t buf[6])

{

    memset(buf, 0, 6);



    if (bpp == 32) {

        buf[0] = ((rgb >> 24) & 0xFF);

        buf[1] = ((rgb >> 16) & 0xFF);

        buf[2] = ((rgb >>  8) & 0xFF);

        buf[3] = ((rgb >>  0) & 0xFF);

        buf[4] = ((buf[0] & 1) == 0) << 3 | ((buf[1] & 1) == 0) << 2;

        buf[4]|= ((buf[2] & 1) == 0) << 1 | ((buf[3] & 1) == 0) << 0;

        buf[0] |= 1;

        buf[1] |= 1;

        buf[2] |= 1;

        buf[3] |= 1;

    }

    if (bpp == 16) {

        buf[0] = ((rgb >> 8) & 0xFF);

        buf[1] = ((rgb >> 0) & 0xFF);

        buf[2] = ((buf[0] & 1) == 0) << 1 | ((buf[1] & 1) == 0) << 0;

        buf[0] |= 1;

        buf[1] |= 1;

    }

}

static void tight_palette_rgb2buf(uint32_t rgb, int bpp, uint8_t buf[6])

{

    memset(buf, 0, 6);



    if (bpp == 32) {

        buf[0] = ((rgb >> 24) & 0xFF);

        buf[1] = ((rgb >> 16) & 0xFF);

        buf[2] = ((rgb >>  8) & 0xFF);

        buf[3] = ((rgb >>  0) & 0xFF);

        buf[4] = ((buf[0] & 1) == 0) << 3 | ((buf[1] & 1) == 0) << 2;

        buf[4]|= ((buf[2] & 1) == 0) << 1 | ((buf[3] & 1) == 0) << 0;

        buf[0] |= 1;

        buf[1] |= 1;

        buf[2] |= 1;

        buf[3] |= 1;

    }

    if (bpp == 16) {

        buf[0] = ((rgb >> 8) & 0xFF);

        buf[1] = ((rgb >> 0) & 0xFF);

        buf[2] = ((buf[0] & 1) == 0) << 1 | ((buf[1] & 1) == 0) << 0;

        buf[0] |= 1;

        buf[1] |= 1;

    }

}

static void FUNC_0(uint32_t VAR_0, int VAR_1, uint8_t VAR_2[6])

{

    memset(VAR_2, 0, 6);



    if (VAR_1 == 32) {

        VAR_2[0] = ((VAR_0 >> 24) & 0xFF);

        VAR_2[1] = ((VAR_0 >> 16) & 0xFF);

        VAR_2[2] = ((VAR_0 >>  8) & 0xFF);

        VAR_2[3] = ((VAR_0 >>  0) & 0xFF);

        VAR_2[4] = ((VAR_2[0] & 1) == 0) << 3 | ((VAR_2[1] & 1) == 0) << 2;

        VAR_2[4]|= ((VAR_2[2] & 1) == 0) << 1 | ((VAR_2[3] & 1) == 0) << 0;

        VAR_2[0] |= 1;

        VAR_2[1] |= 1;

        VAR_2[2] |= 1;

        VAR_2[3] |= 1;

    }

    if (VAR_1 == 16) {

        VAR_2[0] = ((VAR_0 >> 8) & 0xFF);

        VAR_2[1] = ((VAR_0 >> 0) & 0xFF);

        VAR_2[2] = ((VAR_2[0] & 1) == 0) << 1 | ((VAR_2[1] & 1) == 0) << 0;

        VAR_2[0] |= 1;

        VAR_2[1] |= 1;

    }

}

static void FUNC_0(uint32_t VAR_0, int VAR_1, uint8_t VAR_2[6])
{ memset(VAR_2, 0, 6); if (VAR_1 == 32) { VAR_2[0] = ((VAR_0 >> 24) & 0xFF); VAR_2[1] = ((VAR_0 >> 16) & 0xFF); VAR_2[2] = ((VAR_0 >>  8) & 0xFF); VAR_2[3] = ((VAR_0 >>  0) & 0xFF); VAR_2[4] = ((VAR_2[0] & 1) == 0) << 3 | ((VAR_2[1] & 1) == 0) << 2; VAR_2[4]|= ((VAR_2[2] & 1) == 0) << 1 | ((VAR_2[3] & 1) == 0) << 0; VAR_2[0] |= 1; VAR_2[1] |= 1; VAR_2[2] |= 1; VAR_2[3] |= 1; } if (VAR_1 == 16) { VAR_2[0] = ((VAR_0 >> 8) & 0xFF); VAR_2[1] = ((VAR_0 >> 0) & 0xFF); VAR_2[2] = ((VAR_2[0] & 1) == 0) << 1 | ((VAR_2[1] & 1) == 0) << 0; VAR_2[0] |= 1; VAR_2[1] |= 1; } }