[16 bit] cast values when setting to u32 flags variable since on 16 bits the value is 16 bit and thus can't be shifted