Let's say I have the
array = [1,2,3,4]
What I want is NOT to convert to the number 1234; but to take the bits of 1, 2, 3 and 4, concatenate them and convert back to a number.
In other words, I would have to perhaps convert each number/digit to binary, concatenate them and then convert back to a number.
Therefore, 1,2,3,4 would be 00000001
, 00000010
, 00000011
, 00000100
respectively. Concatenating them would lead to 00000001000000100000001100000100
which converted to an unsigned int would be 16909060
Keep in mind that the digits from the array come from ord(characters)
, so they should be 8bits in length, therefore concatenated should lead to a 32bit number
How would I do that?