E
Evangelista Sami
hello
i have to write a program in which i encode / decode datas into bits
vector.
and i do not really know how to do it.
my solution is to represent my bits as a char *.
so extracting the 32 first bits of a vector is done by :
bits[0] << 24 | bits[1] << 16 | bits[2] << 8 | bits[3]
or
bits[0] >> 24 | bits[1] >> 16 | bits[2] >> 8 | bits[3]
depending on how i encode my datas. is this correct?
so the program makes the hypothesis that a char takes 8 bits.
i dont know if this is correct. is this defined in C99?
any help would be very useful. in particuliar is there a more
efficient way to do this?
i have to write a program in which i encode / decode datas into bits
vector.
and i do not really know how to do it.
my solution is to represent my bits as a char *.
so extracting the 32 first bits of a vector is done by :
bits[0] << 24 | bits[1] << 16 | bits[2] << 8 | bits[3]
or
bits[0] >> 24 | bits[1] >> 16 | bits[2] >> 8 | bits[3]
depending on how i encode my datas. is this correct?
so the program makes the hypothesis that a char takes 8 bits.
i dont know if this is correct. is this defined in C99?
any help would be very useful. in particuliar is there a more
efficient way to do this?