utils: fix get_id32 with non-ascii chars

This commit is contained in:
bnnm 2021-09-12 20:02:21 +02:00
parent 0b01723630
commit af6a1e7469

View File

@ -140,7 +140,7 @@ static inline int clamp16(int32_t val) {
/* transforms a string to uint32 (for comparison), but if this is static + all goes well
* compiler should pre-calculate and use uint32 directly */
static inline /*const*/ uint32_t get_id32be(const char* s) {
return (uint32_t)(s[0] << 24) | (s[1] << 16) | (s[2] << 8) | (s[3] << 0);
return (uint32_t)((uint8_t)s[0] << 24) | ((uint8_t)s[1] << 16) | ((uint8_t)s[2] << 8) | ((uint8_t)s[3] << 0);
}
//static inline /*const*/ uint32_t get_id32le(const char* s) {