mirror of
https://github.com/chhylp123/hifiasm.git
synced 2026-09-25 04:58:12 +08:00
r329: a bit code cleanup
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#define HA_VERSION "0.13-r328-dirty"
|
||||
#define HA_VERSION "0.13-r329-dirty"
|
||||
|
||||
#define VERBOSE 0
|
||||
|
||||
|
||||
@@ -58,6 +58,14 @@ typedef struct {
|
||||
for (i = (lsize >> 1) - 1; i != (size_t)(-1); --i) \
|
||||
ks_heapdown_##name(i, lsize, l); \
|
||||
} \
|
||||
void ks_heapsort_##name(size_t lsize, type_t l[]) \
|
||||
{ \
|
||||
size_t i; \
|
||||
for (i = lsize - 1; i > 0; --i) { \
|
||||
type_t tmp; \
|
||||
tmp = *l; *l = l[i]; l[i] = tmp; ks_heapdown_##name(0, i, l); \
|
||||
} \
|
||||
} \
|
||||
static inline void __ks_insertsort_##name(type_t *s, type_t *t) \
|
||||
{ \
|
||||
type_t *i, *j, swap_tmp; \
|
||||
|
||||
+6
-9
@@ -57,16 +57,14 @@ static void select_mz(ha_mz1_v *p, int len, int max_high_occ)
|
||||
int32_t j, k, st = last0 + 1, en = i;
|
||||
for (j = st, k = 0; j < en && k < max_high_occ; ++j, ++k)
|
||||
b[k] = p->a[j], b[k].pos = j; // b[].pos keeps the index in p->a[]
|
||||
if (j < en) { // if there are more, choose top max_high_occ
|
||||
assert(k == max_high_occ);
|
||||
ks_heapmake_mz(max_high_occ, b); // initialize the binomial heap
|
||||
for (; j < en; ++j) {
|
||||
if (mz_lt(p->a[j], b[0])) { // then update the heap
|
||||
b[0] = p->a[j], b[0].pos = j;
|
||||
ks_heapdown_mz(0, max_high_occ, b);
|
||||
}
|
||||
ks_heapmake_mz(k, b); // initialize the binomial heap
|
||||
for (; j < en; ++j) { // if there are more, choose top max_high_occ
|
||||
if (mz_lt(p->a[j], b[0])) { // then update the heap
|
||||
b[0] = p->a[j], b[0].pos = j;
|
||||
ks_heapdown_mz(0, k, b);
|
||||
}
|
||||
}
|
||||
//ks_heapsort_mz(k, b); // sorting is not needed for now
|
||||
for (j = 0; j < k; ++j)
|
||||
if (b[j].rid < pe - ps)
|
||||
p->a[b[j].pos].rid = 0;
|
||||
@@ -77,7 +75,6 @@ static void select_mz(ha_mz1_v *p, int len, int max_high_occ)
|
||||
for (i = n = 0; i < (int32_t)p->n; ++i) // squeeze out filtered minimizers
|
||||
if (p->a[i].rid == 0)
|
||||
p->a[n++] = p->a[i];
|
||||
// fprintf(stderr, "X\tn0=%d,n1=%d,m=%d\n", p->n, n, m);
|
||||
p->n = n;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user