comparison chromeister/src/commonFunctions.h @ 0:4616cc3476d4 draft

Uploaded
author bitlab
date Sat, 15 Dec 2018 18:06:48 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4616cc3476d4
1 #ifndef COMMON_FUNCTIONS_H
2 #define COMMON_FUNCTIONS_H
3 #include "structs.h"
4 /**
5 * Print the error message 's' and exit(-1)
6 */
7 void terror(char *s);
8
9
10 /**
11 * Function to read char by char buffered from a FILE
12 */
13 char buffered_fgetc(char *buffer, uint64_t *pos, uint64_t *read, FILE *f);
14
15 /*
16 Generates a queue of tasks for threads
17 */
18 Queue * generate_queue(Head * queue_head, uint64_t t_reads, uint64_t n_threads, uint64_t levels);
19
20 /*
21 Prints a queue task
22 */
23 void print_queue(Queue * q);
24
25 /*
26 Gets the next task to do when a pthread is free
27 */
28 Queue * get_task_from_queue(Head * queue_head, pthread_mutex_t * lock);
29
30 uint64_t quick_pow4(uint64_t n);
31
32 uint64_t quick_pow4byLetter(uint64_t n, const char c);
33
34 uint64_t hashOfWord(const unsigned char * word, uint32_t k, uint64_t offset);
35
36 void perfect_hash_to_word(unsigned char * word, uint64_t hash, uint32_t k);
37
38 uint64_t collisioned_hash(const unsigned char * word, uint32_t k);
39
40 void decomposed_hash_of_word(const unsigned char * word, unsigned char * vector, uint32_t k);
41
42 uint64_t xor_decomposed_hash(unsigned char * vector1, unsigned char * vector2, uint32_t k);
43
44 uint64_t asciiToUint64(const char *text);
45
46 unsigned char complement(unsigned char c);
47
48 void inplace_reverse_and_complement(unsigned char *d, uint64_t l);
49
50
51 #endif /* COMMON_FUNCTIONS_H */