#ifndef __HA_HTAB_H__ #define __HA_HTAB_H__ #define __STDC_LIMIT_MACROS #include #include "Process_Read.h" #include "CommandLines.h" typedef struct { uint64_t x; uint64_t rid:28, pos:27, rev:1, span:8; } ha_mz1_t; typedef struct { uint64_t rid:28, pos:27, rev:1, span:8; } ha_seed_t; typedef struct { uint32_t n, m; ha_mz1_t *a; } ha_mz1_v; extern const unsigned char seq_nt4_table[256]; void *ha_gen_flt_tab(const hifiasm_opt_t *asm_opt, All_reads *rs); void *ha_gen_mzidx(const hifiasm_opt_t *asm_opt, const void *flt_tab, All_reads *rs); void trio_partition(void); int ha_ft_isflt(const void *hh, uint64_t y); void ha_ft_destroy(void *h); void ha_idx_destroy(void *h); double yak_cputime(void); void yak_reset_realtime(void); double yak_realtime(void); long yak_peakrss(void); void ha_sketch(const char *str, int len, int w, int k, uint32_t rid, int is_hpc, ha_mz1_v *p, const void *hf); int yak_analyze_count(int n_cnt, const int64_t *cnt, int *peak_het); static inline uint64_t yak_hash64(uint64_t key, uint64_t mask) // invertible integer hash function { key = (~key + (key << 21)) & mask; // key = (key << 21) - key - 1; key = key ^ key >> 24; key = ((key + (key << 3)) + (key << 8)) & mask; // key * 265 key = key ^ key >> 14; key = ((key + (key << 2)) + (key << 4)) & mask; // key * 21 key = key ^ key >> 28; key = (key + (key << 31)) & mask; return key; } static inline uint64_t yak_hash64_64(uint64_t key) { key = ~key + (key << 21); key = key ^ key >> 24; key = (key + (key << 3)) + (key << 8); key = key ^ key >> 14; key = (key + (key << 2)) + (key << 4); key = key ^ key >> 28; key = key + (key << 31); return key; } static inline uint64_t yak_hash_long(uint64_t x[4]) { int j = x[1] < x[3]? 0 : 1; return yak_hash64_64(x[j<<1|0]) + yak_hash64_64(x[j<<1|1]); } #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)))) #ifndef klib_unused #if (defined __clang__ && __clang_major__ >= 3) || (defined __GNUC__ && __GNUC__ >= 3) #define klib_unused __attribute__ ((__unused__)) #else #define klib_unused #endif #endif /* klib_unused */ #endif // __YAK_H__