I think it might be clearer what's going on here if you wrote this as

```
r: val >> (4 * 4 & 0xFF),
g: val >> (2 * 4 & 0xFF),
b: val >> (0 * 4 & 0xFF)
```
Even though some of the code is unnecessary