其实uintX_t就是通过typedef定义的,利用预编译和typedef可提高效率也方便代码移植。
在MDK5编译器中的stdint.h文件夹中,详细定义了uintX_t的各种类型,如下所示:
/*
* 'signed' is redundant below, except for 'signed char' and if
* the typedef is used to declare a bitfield.
* '__int64' is used instead of 'long long' so that this header
* can be used in --strict mode.
*/
/* 7.18.1.1 */
/* exact-width signed integer types */
typedef signed char int8_t; //ÓзûºÅ8λÊý
typedef signed short int int16_t; //ÓзûºÅ16λÊý
typedef signed int int32_t; //ÓзûºÅ32λÊý
typedef signed __int64 int64_t; //ÓзûºÅ63λÊý
/* exact-width unsigned integer types */
typedef unsigned char uint8_t; //ÎÞ·ûºÅ8λÊý
typedef unsigned short int uint16_t; //ÎÞ·ûºÅ16λÊý
typedef unsigned int uint32_t; //ÎÞ·ûºÅ32λÊý
typedef unsigned __int64 uint64_t; //ÎÞ·ûºÅ64λÊý