M
Martin Andersson
Hi
-------------------------------------------------------------
typedef struct bitarray {
unsigned short length; /* number of significant bits */
unsigned char *value;
} bitarray;
bitarray V1,V2;
char *V1V2;
-------------------------------------------------------------
unsigned char *value should represent a binary vector (or what
it might be called).
If I now like to concatenate V1.value and V2.value how
to do so. If the number of significant bits of V1.value don't
have an multiple of 8bits.I must start to shift and keep track of the bits.
So I was hoping that any one has some good example how to accomplish this.
Example
bits byte position
V1.value ---> 01010101 [0]
01010101 [1]
01010 [2]
V2.value ---> 10101010 [0]
0101010 [1]
V1V2 ---> 01010101 [0]
01010101 [1]
01010101 [2]
01010010 [3]
1010 [4]
-------------------------------------------------------------
typedef struct bitarray {
unsigned short length; /* number of significant bits */
unsigned char *value;
} bitarray;
bitarray V1,V2;
char *V1V2;
-------------------------------------------------------------
unsigned char *value should represent a binary vector (or what
it might be called).
If I now like to concatenate V1.value and V2.value how
to do so. If the number of significant bits of V1.value don't
have an multiple of 8bits.I must start to shift and keep track of the bits.
So I was hoping that any one has some good example how to accomplish this.
Example
bits byte position
V1.value ---> 01010101 [0]
01010101 [1]
01010 [2]
V2.value ---> 10101010 [0]
0101010 [1]
V1V2 ---> 01010101 [0]
01010101 [1]
01010101 [2]
01010010 [3]
1010 [4]