added back comments

master
Avril 3 years ago
parent a8ad26ec5e
commit 322193f14a
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -15,6 +15,9 @@
#define LIF(ex) if(LIKELY(!!(ex)))
#define UIF(ex) if(UNLIKELY(!!(ex)))
//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)
{
register ssize_t r = fread(out, 1, *size, f);
@ -30,9 +33,10 @@ static int fwrite_all(const void* _buf, size_t sz, size_t num, FILE* out)
else return 1;
}
static inline void pbits(char out[restrict 8], unsigned char byte, const char bit[static 2])
static void pbits(char out[restrict 8], unsigned char byte, const char bit[static 2])
{
for(register int i=8; i --> 0; byte >>= 1) *out++=bit[byte & 1];
//TODO: In explicitly threaded version, we can use an atomic (atomic.h) 64-bit integer `store()` to output those 8 bytes in `out`, which will be re-cast as `uint64_t out[restrict 1]`
}
// Light assertion (likely to succeed)

Loading…
Cancel
Save