80265657aadfc44b510d03b44d8858cae0dfbda7
hiram
  Sun Jun 26 16:26:24 2022 -0700
can use the largest integer for the maximum chrom size for chrom sizes up to 2^31 - 1 no redmine

diff --git src/hg/lib/chromBins.c src/hg/lib/chromBins.c
index c27fb73..74ebab8 100644
--- src/hg/lib/chromBins.c
+++ src/hg/lib/chromBins.c
@@ -1,28 +1,25 @@
 /* chromBins - object for storing per-chrom binKeeper objects */
 
 /* Copyright (C) 2014 The Regents of the University of California 
  * See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */
+#include <limits.h>
 #include "common.h"
 #include "chromBins.h"
 #include "binRange.h"
 #include "hash.h"
 
-
-/* Sized hold a very larger chromosome. */
-static const int MAX_CHROM_SIZE = 1000000000;
-
 struct chromBins *chromBinsNew(chromBinsFreeFunc *freeFunc)
 /* create a new chromBins object */
 {
 struct chromBins *chromBins;
 AllocVar(chromBins);
 chromBins->freeFunc = freeFunc;
 chromBins->chromTbl = hashNew(19); /* handle scaffolds too */
 return chromBins;
 }
 
 static void freeChrom(struct chromBins *chromBins, struct binKeeper *chromBk)
 /* free a chrom's binRange and optional  entries */
 {
 if (chromBins->freeFunc != NULL)
     {
@@ -58,31 +55,31 @@
 struct hashCookie cookie = hashFirst(chromBins->chromTbl);
 struct hashEl* hel;
 while ((hel = hashNext(&cookie)) != NULL)
     slSafeAddHead(&chroms, slNameNew(hel->name));
 return chroms;
 }
 
 struct binKeeper *chromBinsGet(struct chromBins* chromBins, char *chrom,
                                boolean create)
 /* get chromosome binKeeper, optionally creating if it doesn't exist */
 {
 if (create)
     {
     struct hashEl *hel = hashStore(chromBins->chromTbl, chrom);
     if (hel->val == NULL)
-        hel->val = binKeeperNew(0, MAX_CHROM_SIZE);
+        hel->val = binKeeperNew(0, INT_MAX);
     return (struct binKeeper*)hel->val;
     }
 else
     return (struct binKeeper*)hashFindVal(chromBins->chromTbl, chrom);
 }
 
 void chromBinsAdd(struct chromBins *chromBins, char *chrom, int start, int end,
                   void *obj)
 /* add an object to a by chrom binKeeper hash */
 {
 struct binKeeper *bins = chromBinsGet(chromBins, chrom, TRUE);
 binKeeperAdd(bins, start, end, obj);
 }