Two shifts is a good way to do an arbitrary sign extend, like this 24->32-bit one. It's fine.

The alternative would be to for each subcomponent do:

x |= (x & 0x800000) ? 0xFF000000 : 0x0;

but I think that would be slower.