CPU大小端的判断
2016-01-15 09:16
155 查看
#include <stdio.h> #include <stdlib.h> //X86 and MCU is little endian. /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int checkType() { unsigned int value = 0x1122; unsigned short int temp = (unsigned short int)value; return temp==0x22?1:0; } int main(int argc, char *argv[]) { if(checkType()) printf("this computer is big endian\n"); else printf("this computer is little endian\n"); return 0; }
相关文章推荐
- DisplayTag用法
- Android优化应用启动速度
- oracle 查看主外键约束
- 2015-2016-2 课程
- 记录一些使用的abap小程序帮助开发
- mysql+mybatis 集合查询配置
- UISearchDisplayController
- OpenWSN资料汇总
- 在Swift中,如何像Objective-C定义可选接口?
- Linux网络管理相关工具
- 微信红包JAVA代码整理
- Menu的用法
- 酒瓶和瓶盖换购新酒
- ip命令详解
- C#中DataGridView控件使用大全
- 装X神器--Hacker Typer
- IP地址之IPv6
- 【OpenGL/ES系列教程】第一讲 3D数学-逆矩阵的推导
- C函数和C++函数相互调用
- c++实现精确计时