#include "game_types.h"

/* Bit_PackColor_08002498 @ 0x08002498 (real 106B) -- RGB555 blend of two weighted channel pairs. Mirrors src/matched/Bit_PackColor_08002498.c. */
/* Blends channel pairs (a, b) and (c, d) with Q12 weights into an RGB555
   word: each 5-bit lane is (x*b + y*d) >> 12. */
int Bit_PackColor_08002498(int a, int b, int c, int d)
{
    int r = (((a & 31) * b + (c & 31) * d) >> 12) & 31;
    int g = ((((a >> 5) & 31) * b + ((c >> 5) & 31) * d) >> 12) & 31;
    int bl = ((((a >> 10) & 31) * b + ((c >> 10) & 31) * d) >> 12) & 31;
    return r | (g << 5) | (bl << 10);
}
