# Assembly what is signed and unsigned

JL Jump if (signed) less
JNA Jump if (unsigned) not above

Can someone explain me what is signed and unsigned means.
with a example if possible
###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
There are two types of integers : signed and unsigned integers.

A signed integer can hold both positive and negative values (in fact, one of the bits will commonly be used as the sign bit, leaving the remaining bits for the value).
And unsigned integer can only hold positive values (ie. all bits will be used for the value).
0
Commented:
For further info, see eg. the "Value and representation" paragraph of this wiki :

http://en.wikipedia.org/wiki/Integer_(computer_science)
0
Commented:
as Infinity08 mentioned there are two types of binary representation. A little example:
signed (-/+) and unsigned (only positive)

0b0101 is 1*2^0+1*2^2 = 5 in signed
0b0101 is the same in unsigned

BUT:
in signed representation the first bit indicates whether you have a negative value or not.

if we would like to display -5 we would have to do as follows
5 = 0b0101 -> invert -> 0b1010 -> +1 -> 0b1011
which is called the two's complement

so the binary representation of -5 woul be 0b1011 (in signed representation)

you see:
0b1011 if signed represents -5,
however if your value is defined to be unsigned it represents (1*2^3+0*2^2+1*2^1+1*2^0) = 11

therefore you always should know if your values are being written as signed or unsigned.

let a=-5=0b1011 and b=2=0b0010
with JL Jump if (signed) less => it will jump since -5 < 2
JNA Jump if (unsigned) not above => it will not jump since 0b1011 (=11) > 0b0010 (=2)
0

Experts Exchange Solution brought to you by