ref: 4767d3be045d6975c5458543bd8ac13dae9bdee3
parent: 8ecc72dc7b21afb3f1e0c1bf8a0f6f037ad4707c
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Apr 13 22:52:15 EDT 2023
range: avoid integer overflow if our ranges were large enough, we would truncate and miscompare when converting to int. Don't do that.
--- a/load.c
+++ b/load.c
@@ -9,7 +9,11 @@
static int
rangecmp(Avl *a, Avl *b)
{
- return ((Arange*)a)->off - ((Arange*)b)->off;
+ if(((Arange*)a)->off < ((Arange*)b)->off)
+ return -1;
+ if(((Arange*)a)->off > ((Arange*)b)->off)
+ return 1;
+ return 0;
}
static void