How to get the architectural size with assembly?
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.
精彩评论