flat assembler
Message board for the users of flat assembler.

Index > Windows > cmp with big immediate operand

Author
Thread Post new topic Reply to topic
alessandro95



Joined: 24 Mar 2013
Posts: 62
alessandro95
Why, while writing 64bit code, the range allowed for cmp's immediate operand is a 32bit signed integer?

Code:
format PE64 GUI 5.0

cmp rax, 10000000000
    


for example, gives an out of range error
Post 11 Apr 2013, 01:23
View user's profile Send private message Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1180
Location: Unknown
HaHaAnonymous
[ Post removed by author. ]


Last edited by HaHaAnonymous on 28 Feb 2015, 21:06; edited 1 time in total
Post 11 Apr 2013, 03:06
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17714
Location: In your JS exploiting you and your system
revolution
alessandro95 wrote:
Why, while writing 64bit code, the range allowed for cmp's immediate operand is a 32bit signed integer?
HaHaAnonymous is correct. The x86 CPU design does not have any way to encode numbers >= 2^31 in the immediate field of cmp. fasm gives you the correct response to say that you can't encode such a thing. IIRC only the mov instruction allows 64-bit immediate values.
Post 11 Apr 2013, 07:09
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.