make portable for ARM (do not rely on char being signed as default. Always explicitely use signed or unsigned char)