8086机器都是使用little endian, 而摩托罗拉的power pc使用big endian
对于一个数0x1122
产用little endian方式时 低字节存储0x22,高字节存储0x11.
而使用big endian方式时, 低字节存储0x11, 高字节存储0x22
在这俩种字节方式间转换可以使用汇编指令 BSWAP
测试函数
int IsMyMachineBigEndian()
{
unsigned short test = 0x1122;
unsigned char *cp = &test;
return (*cp == 0x11);
}
若返回真值,则说明是big endian
big endian VS little endian
原创文章标签 职场 休闲 big endian little endian 文章分类 其他 编程语言
©著作权归作者所有:来自51CTO博客作者xc_shen的原创作品,请联系作者获取转载授权,否则将追究法律责任
big endian VS little endian
https://blog.51cto.com/xcshen/756855
big endian VS little endian
https://blog.51cto.com/xcshen/756855
上一篇:Android图形系统
举报文章
请选择举报类型
内容侵权
涉嫌营销
内容抄袭
违法信息
其他
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M

提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
大端和小端(Big endian and Little endian)
大端和小端(Big endian and Little endian)
网络字节顺序 字节序 #define 大端小端 linux -
socket 通信 Windos 和 Linux之间 Big endian 和 little endian的转换策略
Big endian 和 little endian本次测试仅仅一32B
d3 #pragma 字节序 网络字节序 f5