hist_context: improved bool vector to int conversion

a timeit test shows that using sum() and enumerate() is faster
4 jobs for fix/bool_vector in 17 minutes and 32 seconds