diff options
Diffstat (limited to 'opcodes/z8kgen.c')
-rw-r--r-- | opcodes/z8kgen.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/opcodes/z8kgen.c b/opcodes/z8kgen.c index 2012bc4..cbd316d 100644 --- a/opcodes/z8kgen.c +++ b/opcodes/z8kgen.c @@ -567,9 +567,14 @@ count (void) } static int -func (struct op *a, struct op *b) +func (const void *p1, const void *p2) { - return strcmp ((a)->name, (b)->name); + const struct op *a = p1; + const struct op *b = p2; + int ret = strcmp (a->name, b->name); + if (ret != 0) + return ret; + return p1 > p2; } @@ -909,7 +914,7 @@ internal (void) memcpy (new_op, p, c * sizeof (struct op)); /* Sort all names in table alphabetically. */ - qsort (new_op, c, sizeof (struct op), (int (*)(const void *, const void *))func); + qsort (new_op, c, sizeof (struct op), func); p = new_op; while (p->flags && p->flags[0] != '*') @@ -965,7 +970,7 @@ gas (void) memcpy (new_op, p, c * sizeof (struct op)); /* Sort all names in table alphabetically. */ - qsort (new_op, c, sizeof (struct op), (int (*)(const void *, const void *)) func); + qsort (new_op, c, sizeof (struct op), func); printf ("/* DO NOT EDIT! -*- buffer-read-only: t -*-\n"); printf (" This file is automatically generated by z8kgen. */\n\n"); |