This tip has been extracted from the full Choosing an Integer Data Type article.
The char type is not the most efficiently accessed integer type when using MPLAB XC16 or XC32, yet it is for XC8. How can you write portable code that is efficient for all device targets? Easy: Use the fastest minimum-width integer types provided by <stdint.h>, and don’t make assumptions about which type will produce the smallest or fastest code.
For example if you need a variable that can hold an 8-bit quantity, make it either of the int_fast8_t or uint_fast8_t types. If you need a variable that can hold a 16-bit quantity, use either of the int_fast16_t or uint_fast16_t types, etc. The compiler will define these types appropriately and ensure that your code is compact and runs as fast as possible, regardless of which device you are targeting.
Microchip Technology acquires Atmel