##// END OF EJS Templates
xdiff: use int64 for hash table size...
Jun Wu -
r36843:f1ef0e53 default
parent child Browse files
Show More
@@ -70,7 +70,7 b' static int xdl_optimize_ctxs(xdlclassifi'
70 static int xdl_init_classifier(xdlclassifier_t *cf, int64_t size, int64_t flags) {
70 static int xdl_init_classifier(xdlclassifier_t *cf, int64_t size, int64_t flags) {
71 cf->flags = flags;
71 cf->flags = flags;
72
72
73 cf->hbits = xdl_hashbits((unsigned int) size);
73 cf->hbits = xdl_hashbits(size);
74 cf->hsize = 1 << cf->hbits;
74 cf->hsize = 1 << cf->hbits;
75
75
76 if (xdl_cha_init(&cf->ncha, sizeof(xdlclass_t), size / 4 + 1) < 0) {
76 if (xdl_cha_init(&cf->ncha, sizeof(xdlclass_t), size / 4 + 1) < 0) {
@@ -262,7 +262,7 b' static int xdl_prepare_ctx(unsigned int '
262 goto abort;
262 goto abort;
263
263
264 {
264 {
265 hbits = xdl_hashbits((unsigned int) narec);
265 hbits = xdl_hashbits(narec);
266 hsize = 1 << hbits;
266 hsize = 1 << hbits;
267 if (!(rhash = (xrecord_t **) xdl_malloc(hsize * sizeof(xrecord_t *))))
267 if (!(rhash = (xrecord_t **) xdl_malloc(hsize * sizeof(xrecord_t *))))
268 goto abort;
268 goto abort;
@@ -141,9 +141,10 b' uint64_t xdl_hash_record(char const **da'
141 return ha;
141 return ha;
142 }
142 }
143
143
144 unsigned int xdl_hashbits(unsigned int size) {
144 unsigned int xdl_hashbits(int64_t size) {
145 unsigned int val = 1, bits = 0;
145 int64_t val = 1;
146 unsigned int bits = 0;
146
147
147 for (; val < size && bits < CHAR_BIT * sizeof(unsigned int); val <<= 1, bits++);
148 for (; val < size && bits < (int64_t) CHAR_BIT * sizeof(unsigned int); val <<= 1, bits++);
148 return bits ? bits: 1;
149 return bits ? bits: 1;
149 }
150 }
@@ -32,7 +32,7 b' void *xdl_cha_alloc(chastore_t *cha);'
32 int64_t xdl_guess_lines(mmfile_t *mf, int64_t sample);
32 int64_t xdl_guess_lines(mmfile_t *mf, int64_t sample);
33 int xdl_recmatch(const char *l1, int64_t s1, const char *l2, int64_t s2);
33 int xdl_recmatch(const char *l1, int64_t s1, const char *l2, int64_t s2);
34 uint64_t xdl_hash_record(char const **data, char const *top);
34 uint64_t xdl_hash_record(char const **data, char const *top);
35 unsigned int xdl_hashbits(unsigned int size);
35 unsigned int xdl_hashbits(int64_t size);
36
36
37
37
38
38
General Comments 0
You need to be logged in to leave comments. Login now