Bit operations in C++

#pragma once
 
#define bit_get(v, i)   (((unsigned char *)v)[i/8] & (1 << (i % 8)))
#define bit_set(v, i)   (((unsigned char *)v)[i/8] |= (1 << (i % 8)))
#define bit_clr(v, i)   (((unsigned char *)v)[i/8] ^= (1 << (i % 8)))
 
void bit_read(void *dest, const void *src, int offset, int size)
{
    if (size != 0) {
        for (int i = 0; i < size; i++) {
            if (bit_get(src, offset + i)) {
                bit_set(dest, i);
            }
        }
    }
}