#ifndef COMMON_H #define COMMON_H #include #include #include #include #include // Avoids aggresive memory reallocation at the beginning of buffer growth sequence #define INIT_BUFFER_SIZE 16 // Optimal exponential buffer growth factor, 2 is sometimes used to #define GROWTH_FACTOR 1.5 // Maximum length of the file that will be read (not applicable to a1) #define MAX_LINE_LENGTH 8192 // TODO: define custom structure for this probably #define CODE_SIZE 0 #define CODE_INDEX 1 #define NUM_CODES 2 void *my_malloc(size_t size); void *my_calloc(size_t nitems, size_t size); void *my_realloc(void *ptr, size_t size); FILE *my_fopen(const char *filename, const char *mode); void *buffer_grow(void *ptr, int sizeBufferUsed, int *sizeBufferTotal); bool check_parallel_worth(int numProcesses, int numCount, int limit); void spread_evenly(int numProcesses, int sizeBufferUsed, int multiplier, int **arrBlockIndices, int **arrBlockSizes); void *read_matrix_file(const char *filename, int *numCols, int *numCount); int transpose_index(int index, int rows, int cols); #endif