Add 2 BIts to beginning of a Byte
I need to add two bits from one byte to the beginning of another 8 bit number. Example
Byte 1 Byte 2
00110011 11000100
11------>11000100 to get 1111000100
Plus this is happening at 300/second so the faster the better.
I've read about the bitarray() class but they don't have a way to get more than one value from the bit array at a time.
I also tried bitmasking the first 6 bits in byte one to get the last two bytes (which works) and then add them to byte2 but if I use the ampersan ("&") it just adds the value of the two bits to the value of the next 8 bits, Example:
11 (Value of 3) to 00000111(value of 7) = 37
not what I need
If I use the "+" operator it just add the two numbers 3+7 = 10
BUT I need the value for 1111000100 .
Sorry if this is confusing at all.....
Thanks,
Bebandit