Matteo Bruni (@Mystral) commented about dlls/d3dx9_36/tests/texture.c:
static DWORD get_expected_argb_color(D3DFORMAT format, const D3DXVECTOR4 *v) { switch (format) { case D3DFMT_A8R8G8B8:
return (BYTE)(v->w * 255 + 0.5f) << 24
| (BYTE)(v->x * 255 + 0.5f) << 16
| (BYTE)(v->y * 255 + 0.5f) << 8
| (BYTE)(v->z * 255 + 0.5f);
return get_s8_clipped(v->w) << 24
| get_s8_clipped(v->x) << 16
| get_s8_clipped(v->y) << 8
case D3DFMT_A1R5G5B5:| get_s8_clipped(v->z);
Formatting nit: we usually put a blank line before the case label: line (except the first one) rather than between the case label: and the relevant code.