x86程序集以编程方式确定字节序 [英] x86 assembly to programmatically determine endianess
本文介绍了x86程序集以编程方式确定字节序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我了解到Intel 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.
这篇关于x86程序集以编程方式确定字节序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文