Please explain code!
-
Hi I just started C++, but this code I found on the net blew me away. Could someone please help me understand, especially the lines market with a /**/. void read_data_from_bs(void *data, int bits_of_data, unsigned char *bit_stream, unsigned long & bit_offset) { int i; int n; while (bits_of_data > 0) { // <-- Colored with red by Instant Match n = bits_of_data > 8 ? 8 : bits_of_data; /**/ *(unsigned char *)data = 0; for (i = 0; i < n; i++) { if (read_bit(bit_stream, bit_offset)) { (*(unsigned char *)data) |= (1 << i); /**/ } bit_offset++ ; } data = ((unsigned char *)data) + 1; /**/ bits_of_data -= n; } }
-
Hi I just started C++, but this code I found on the net blew me away. Could someone please help me understand, especially the lines market with a /**/. void read_data_from_bs(void *data, int bits_of_data, unsigned char *bit_stream, unsigned long & bit_offset) { int i; int n; while (bits_of_data > 0) { // <-- Colored with red by Instant Match n = bits_of_data > 8 ? 8 : bits_of_data; /**/ *(unsigned char *)data = 0; for (i = 0; i < n; i++) { if (read_bit(bit_stream, bit_offset)) { (*(unsigned char *)data) |= (1 << i); /**/ } bit_offset++ ; } data = ((unsigned char *)data) + 1; /**/ bits_of_data -= n; } }