From 908b4f3786906c58033f52e93b7cbecb15e8929a Mon Sep 17 00:00:00 2001 From: chhylp123 Date: Sun, 10 Oct 2021 14:47:16 -0400 Subject: [PATCH] bug fix --- htab.cpp | 7 +------ htab.h | 1 + 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/htab.cpp b/htab.cpp index 264a32b..16d7fee 100644 --- a/htab.cpp +++ b/htab.cpp @@ -676,7 +676,7 @@ static void sf##_worker_for_mz(void *data, long i, int tid)\ (s->p->pt&&(s->p->flag&HAF_COUNT_REFINE))?s->p->pt:NULL, s->p->opt->min_rcnt, asm_opt.dp_min_len, asm_opt.dp_e, &(s->mt[tid]), asm_opt.mz_rewin, s->uq);\ s->mz[i].n = s->mz[i].m = b->n;\ MALLOC(s->mz[i].a, b->n);\ - memcpy(s->mz[i].a, b->a, b->n * sizeof(VType));\ + MEMCPY(s->mz[i].a, b->a, b->n);\ }\ static inline void sf##_pt_insert_buf(sf##_ch_buf_t *buf, int p, const HType *y){\ /**assign minimizer to one of 4096 bins by low 12 bits**/\ @@ -974,7 +974,6 @@ ha_ct_t *ha_count(const hifiasm_opt_t *asm_o, int flag, int HPC, int k, int w, h ///for ha_pt_gen, shoud be 0 opt.bf_shift = flag & HAF_COUNT_EXACT? 0 : asm_o->bf_shift; opt.n_thread = asm_o->thread_num; - // opt.n_thread = p0? 1: asm_o->thread_num; opt.adaLen = (keep_adapter? asm_o->adapterLen : 0); opt.min_rcnt = (low_freq?*low_freq:-1); ///asm_opt->num_reads is the number of fastq files @@ -1085,15 +1084,11 @@ ha_pt_t *ha_pt_ug_gen(const hifiasm_opt_t *asm_opt, const void *flt_tab, ma_utg_ ct = ha_count(asm_opt, HAF_COUNT_EXACT|HAF_UG_READ, is_HPC, k, w, NULL, flt_tab, NULL, us, 0, NULL); fprintf(stderr, "[M::%s::%.3f*%.2f] ==> counted %ld distinct minimizer k-mers\n", __func__, yak_realtime(), yak_cpu_usage(), (long)ct->tot); - exit(1); ///minimizer with YAK_MAX_COUNT occ may apper > YAK_MAX_COUNT times, so it may lead to overflow at ha_pt_gen ha_ct_shrink(ct, min_freq, YAK_MAX_COUNT - 1, asm_opt->thread_num); - fprintf(stderr, "[M::%s::%.3f*%.2f] ==> sb0\n", __func__, yak_realtime(), yak_cpu_usage()); pt = ha_pt_gen(ct, asm_opt->thread_num, 1); - fprintf(stderr, "[M::%s::%.3f*%.2f] ==> sb1\n", __func__, yak_realtime(), yak_cpu_usage()); ha_count(asm_opt, HAF_COUNT_EXACT|HAF_UG_READ, is_HPC, k, w, pt, flt_tab, NULL, us, 0, NULL); - fprintf(stderr, "[M::%s::%.3f*%.2f] ==> sb2\n", __func__, yak_realtime(), yak_cpu_usage()); //ha_pt_sort(pt, asm_opt->thread_num); fprintf(stderr, "[M::%s::%.3f*%.2f] ==> indexed %ld positions\n", __func__, yak_realtime(), yak_cpu_usage(), (long)pt->tot_pos); diff --git a/htab.h b/htab.h index 673d8cf..41549ff 100644 --- a/htab.h +++ b/htab.h @@ -159,6 +159,7 @@ static inline uint64_t yak_hash_long(uint64_t x[4]) #define CALLOC(ptr, len) ((ptr) = (__typeof__(ptr))calloc((len), sizeof(*(ptr)))) #define MALLOC(ptr, len) ((ptr) = (__typeof__(ptr))malloc((len) * sizeof(*(ptr)))) #define REALLOC(ptr, len) ((ptr) = (__typeof__(ptr))realloc((ptr), (len) * sizeof(*(ptr)))) +#define MEMCPY(dest, src, len) (memcpy((dest), (src), (len) * sizeof(*(src)))) #ifndef kroundup32 #define kroundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x))