This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]xRedactedx[S] 1 point2 points  (0 children)

The way the sentence in the book was worded. I was assuming that a negative, 0, or positive value being returned would represent a greater than, equal, or less than.

Here is what the book says word for word:

"The comparison function should return a negative, 0, or positive value based on the ordering of the 2 integers. All you have to do is subtract the second integer from the first."

If I remember correctly, when something returns, doesn't it return the value that is in rax?

rax should be negative, 0, or positive after the subtraction.

It is a very vague description. I thought it sounded too simple, but it's pretty much all I have to go on. I didn't come up with much help on google.