diff --git a/src/bits.c b/src/bits.c index a3aa4c9..2fc0ac8 100644 --- a/src/bits.c +++ b/src/bits.c @@ -10,6 +10,9 @@ #define BUFFER_SIZE 4096 #define IGNORE(param) do { (void)(param); } while(0) +//TODO: For explicitly threaded version: Make a lazy thread spawner, spawning up to 8 threads which will each work on a byte and atomically write back to a central array of `uint64_t [num_of_bytes / num_of_threads]`. +//TODO: But how to sync the fwrites of this buffer? An atomic counter of which threads have completed their operations, and a condvar that allows the controlling thread to check if the counter is full before `fwrite_all()`ing the array, resetting the counter, and carrying on + static inline int sfread(void* out, size_t *restrict size, FILE* f) { return !!(*size = (size_t)fread(out, 1, *size, f));