flat assembler
Message board for the users of flat assembler.

Index > Main > Signed vs unsigned comparison (was 'What am i missing')

Author
Thread Post new topic Reply to topic
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 19 Aug 2010, 01:18
Code:
        mov     cx,1000h
        mov     ax,9fc0h
        sub     ax,cx

        cmp     ax,27e0h
        jl      lies
        jb      truth
    


EDIT by DOS386 : enhanced subject

_________________
Coding a 3D game engine with fasm is like trying to eat an elephant,
you just have to keep focused and take it one 'byte' at a time.
Post 19 Aug 2010, 01:18
View user's profile Send private message Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 790
Location: Adelaide
sinsi 19 Aug 2010, 01:52
signed vs unsigned?
Post 19 Aug 2010, 01:52
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 19 Aug 2010, 02:07
bitshifter,

Does this **really** has something to do with compiler internals or I can move this to Main?
Post 19 Aug 2010, 02:07
View user's profile Send private message Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 19 Aug 2010, 02:21
ooh, its because the value has sign bit set...

facepalm Embarassed

ok to move... (or destroy)
Post 19 Aug 2010, 02:21
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler 19 Aug 2010, 02:30
jl is signed jb isn't

With jl 1111111b would be less than 0, while with jb, it would be opposite.

Edit: You beat me to it.
Post 19 Aug 2010, 02:30
View user's profile Send private message 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.