I have a list with about 32800 elements which are all 0 or 1, so they are binary. (note 0/1 not true/false) Now I need element 0 till 31 in an integer (32bit) format, and save the values in another list. My recent try is too slow, it should take about 10ms and all I got is 600 ms.
Here is what I have so far:
while offset < length:
data_bin1 = int(''.join(map(str, data_bin[offset:(offset+32)])), 2)
note: This should help you to get an idea of what I am looking for.
data_bin is my list with a lenght of 32800 elements formated like this
data_bin=
[0,0,1,0,1,0,1,1,
0,0,1,1,0,1,0,1,
0,0,1,0,1,1,0,1,
0,0,1,1,0,0,1,1,
.... n]
-> 00101011001101010010110100110011 = 724905267
What I need is to take bit 0 till 31, convert them into an int32 value and likely append them to another list or better in a queue.