数据类型变换uint8_t uint16_t等等
2016-07-08 11:16
447 查看
#include <limits.h> #ifdef WIN32 #include <windows.h> #endif /* WIN32 */ #ifdef _MSC_VER /* WIN32 */ /* from http://code.google.com/p/msinttypes/ */ #if _MSC_VER > 1000 #pragma once #endif #if (_MSC_VER < 1300) typedef signed char int8_t; typedef signed short int16_t; typedef signed int int32_t; typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; #else typedef signed __int8 int8_t; typedef signed __int16 int16_t; typedef signed __int32 int32_t; typedef unsigned __int8 uint8_t; typedef unsigned __int16 uint16_t; typedef unsigned __int32 uint32_t; #endif typedef signed __int64 int64_t; typedef unsigned __int64 uint64_t; /********************************/ #else /* *nix */ /* C99 compiler has this head file */ #include <stdint.h> /* do not nee this */ #if 0 /* part of stdint.h from GNU C Library */ /* __WORDSIZE defined in <bits/wordsize.h> */ #ifndef __int8_t_defined # define __int8_t_defined typedef signed char int8_t; typedef short int int16_t; typedef int int32_t; # if __WORDSIZE == 64 typedef long int int64_t; # else __extension__ typedef long long int int64_t; # endif #endif typedef unsigned char uint8_t; typedef unsigned short int uint16_t; #ifndef __uint32_t_defined typedef unsigned int uint32_t; # define __uint32_t_defined #endif #if __WORDSIZE == 64 typedef unsigned long int uint64_t; #else __extension__ typedef unsigned long long int uint64_t; #endif #endif /* #if 0 */ #endif /* _MSC_VER */ /********************************/ typedef int8_t int8; typedef int8_t INT8; typedef uint8_t uint8; typedef uint8_t u8; typedef uint8_t UINT8; typedef int16_t int16; typedef int16_t INT16; typedef uint16_t uint16; typedef uint16_t u16; typedef uint16_t UINT16; typedef uint16_t WORD16; typedef int32_t int32; typedef int32_t INT32; typedef uint32_t uint32; typedef uint32_t u32; typedef uint32_t UINT32; typedef uint32_t WORD32; typedef int64_t int64; typedef int64_t INT64; typedef uint64_t uint64; typedef uint64_t u64; typedef uint64_t UINT64; typedef uint64_t ULONG64; typedef uint64_t WORD64; typedef uint64_t DWORD64;
相关文章推荐
- Linux C函数参考手册(PDF版)
- C# partial关键字说明
- Lua教程(十七):C API简介
- 简单谈谈lua和c的交互
- C#用链式方法表达循环嵌套
- C#中的委托数据类型简介
- C#编写的艺术字类实例代码
- C#实现打造气泡屏幕保护效果
- 举例讲解C#编程中委托的实例化使用
- 使用C#代码获取存储过程返回值
- C和指针小结(推荐)
- C++中explict关键字用法
- C/C++数据对齐详细解析
- 利用C语言来求最大连续子序列乘积的方法
- 字符串的组合算法问题的C语言实现攻略
- C 语言基础教程(我的C之旅开始了)[三]
- 学习C和C++的9点经验总结
- C++中的extern “C”用法详解
- C 语言基础教程(我的C之旅开始了)[七]