FreeCalypso > hg > themwi-system-sw
comparison utils/themwi-update-numdb2.c @ 230:803829e6244f
themwi-update-numdb2: more sensible sort comparison functions
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 14 Aug 2023 11:09:35 -0800 |
parents | 626824449ddf |
children | abb3f415b9dd |
comparison
equal
deleted
inserted
replaced
229:626824449ddf | 230:803829e6244f |
---|---|
381 handler(cp); | 381 handler(cp); |
382 } | 382 } |
383 | 383 |
384 static int | 384 static int |
385 compare_owned_num(p1, p2) | 385 compare_owned_num(p1, p2) |
386 struct owned_number_rec *p1, *p2; | 386 uint16_t *p1, *p2; |
387 { | 387 { |
388 if (p1->number[0] < p2->number[0]) | 388 if (p1[0] < p2[0]) |
389 return(-1); | 389 return(-1); |
390 if (p1->number[0] > p2->number[0]) | 390 if (p1[0] > p2[0]) |
391 return(1); | 391 return(1); |
392 if (p1->number[1] < p2->number[1]) | 392 if (p1[1] < p2[1]) |
393 return(-1); | 393 return(-1); |
394 if (p1->number[1] > p2->number[1]) | 394 if (p1[1] > p2[1]) |
395 return(1); | 395 return(1); |
396 if (p1->number[2] < p2->number[2]) | 396 if (p1[2] < p2[2]) |
397 return(-1); | 397 return(-1); |
398 if (p1->number[2] > p2->number[2]) | 398 if (p1[2] > p2[2]) |
399 return(1); | 399 return(1); |
400 return(0); | 400 return(0); |
401 } | 401 } |
402 | 402 |
403 static int | 403 static int |
404 compare_short_num(p1, p2) | 404 compare_short_num(p1, p2) |
405 struct short_number_rec *p1, *p2; | 405 uint16_t *p1, *p2; |
406 { | 406 { |
407 if (p1->short_num < p2->short_num) | 407 if (*p1 < *p2) |
408 return(-1); | 408 return(-1); |
409 if (p1->short_num > p2->short_num) | 409 if (*p1 > *p2) |
410 return(1); | 410 return(1); |
411 return(0); | 411 return(0); |
412 } | 412 } |
413 | 413 |
414 static void | 414 static void |