Left shifting a potentially negative number is undefined behavior
according to the C standard (still in C23, although that's probably
a mistake for this one).
Shift left the just-read data first, as it is of an unsigned type
(uint8_t), and then sign-extend the result with the new sign_extend32().