Add sort option to is
#13
No reviewers
Labels
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Lephenixnoir/fxos#13
Loading…
Reference in New Issue
No description provided.
Delete Branch "Dr-Carlos/fxos:sort-is"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hello!
This pull request simply adds a sort option to
is
, sorting by type (syscall then address) and then by value.I would probably have just pushed this to upstream but wanted to check if the
operator<
implementation I used to allow this sorting was the right way of doing this.The code for the operator doesn't seem quite right to me? In order to sort by syscall number then by address, you need a lexicographic order, which something like
instead of
which is just a product order. Since the product order is not total, you can't really sort with it.
Other than this, the implementation feels right to me. I'd just add that if there are several interesting orders (eg. by address) and no canonical one then I'd write a set of
compare_this_way()
methods.Yep, makes sense. I have fixed this.
I've added the other methods as they should be (very slight) optimisations if anyone uses them, and also allow
==
comparisons.Note that the standard library basically only uses
==
and<
, and I think (but I'm not sure here) the others might be derivable. Anyways, LGTM; merge at will :)Yes, the others are totally derivable, but, this would take marginally more processing time, so I have added them all for completeness. Merged.