Need function to convert bool array to int- why doesnt this work?
Assuming little-endian bools (least significant bool first), you should use simple bit-shifting, not floating point power calculations:

for(int id=start_index;id&lt;=stop_index;id++){
    result |= b_array[id] ? (1 &lt;&lt; run) : 0;
    run++;
}


The ternary operation (b_array[id] ? (1 &lt;&lt; run) : 0) means:


If b_array[id] is true,  then


Or result with 1 left-shifted run times and store in result

otherwise


Or result with 0 and store the result (no-operation).