Forum Discussion
Altera_Forum
Honored Contributor
15 years agoThe C language doesn't give any standard for integers sizes unfortunately. Usually the "short" and "unsigned short" are 16 bits whereas "long" and "unsigned long" are 32 bits. "int" and "unsigned int" can be 16 or 32 bits depending on the architecture (maybe even 64 bits on some architectures).
If you want to be sure that your code uses the correct size, (and make it easier to port it to a different architecture one day, if needed) you can include <alt_types.h> and use the types defined in the Altera HAL:- alt_8, alt_u8 (8 bits)
- alt_16, alt_u16 (16 bits)
- alt_32, alt_u32 (32 bits)
- alt_64, alt_u64 (64 bits)