如何确定处理器是否是“小端”。或“大端”或“大端” [英] How to find out if a processor is "little endian" or "big endian"

查看:92
本文介绍了如何确定处理器是否是“小端”。或“大端”或“大端”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


如何确定处理器是否为little endian?或大端或大端通过编写C代码???

Hi all,

How to find out if a processor is "little endian" or "big endian" by writing C code???

推荐答案


大家好,


如何确定处理器是否是小端。或大端或大端通过编写C代码???
Hi all,

How to find out if a processor is "little endian" or "big endian" by writing C code???



只要问你的处理器它是不是最简单的?


基本上你应该怎么做做研究这个主题,想想你将如何编码,开始编码.... 然后 回到这里询问你有什么问题。


谢谢

Just ask your processor which it is...wouldn''t this be easiest?

Basically what you should do is research the subject, think of how you''re going to code this, start coding it....THEN come back here and ask about any problems you have.

Thanks


将1放入unsigned int。


将三个字节添加到int的地址。

将该地址的内容分配给unsigned char。


如果你的1在那里,你就是大端。
Put a 1 in an unsigned int.

Add three bytes to the address of the int.

Assign the contents of that address to an unsigned char.

If your 1 is there, you are big endian.



在无符号整数中加1。


在地址中加三个字节int。


将该地址的内容分配给unsigned char。


如果你的1在那里,你就是大端。
Put a 1 in an unsigned int.

Add three bytes to the address of the int.

Assign the contents of that address to an unsigned char.

If your 1 is there, you are big endian.



需要说明!

Explanation needed !


这篇关于如何确定处理器是否是“小端”。或“大端”或“大端”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆