x86程序集以编程方式确定endianess(x86 assembly to programmatically determine endianess)

编程入门 行业动态 更新时间:2024-10-21 23:06:39
x86程序集以编程方式确定endianess(x86 assembly to programmatically determine endianess)

据我所知,英特尔x86是小端。 但是,如何编写汇编以编程方式确定处理器的字节顺序?

I understand that Intel x86 is little endian. However, how would I write assembly to programmatically determine the endianess of a processor?

最满意答案

存储一个具有不同值的单词,每个单词的两个字节(例如0x0001 )。 从同一地址加载一个字节,并检查它匹配的原始字的哪个字节。

Store a word that has different values for each of it’s two bytes (0x0001, for example). Load a byte from the same address and check to see which byte of the original word it matches.

更多推荐

本文发布于:2023-07-04 17:20:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1027011.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:方式   程序   endianess   determine   programmatically

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!