开发者

How to get the architectural size with assembly?

开发者 https://www.devze.com 2023-02-22 17:47 出处:网络
On 32 bit machine ,it should be 4 bytes. On 64 bit,it should be 8 bytes. How to get it wit开发者_如何学Ch assembly?Read data from memory. The number of bytes read is what you\'re looking for. Don\'t

On 32 bit machine ,it should be 4 bytes.

On 64 bit,it should be 8 bytes.

How to get it wit开发者_如何学Ch assembly?


Read data from memory. The number of bytes read is what you're looking for. Don't ask how to do it because you didn't specify any particular CPU.
Anyway, if you code for 32 bit machines it will run on 64 bit too, while the opposite isn't true.
And, since you're programming in asm, you should have different coding for 32 and 64 bit machines to take advantage of the CPU's power. Think about the strlen() function, the 64 bit version is as twice as fast as the 32 bit version; they're both based on the same algo, but are coded slightly different.

0

精彩评论

暂无评论...
验证码 换一张
取 消