Python/Numpy: Convert list of bools to unsigned int,"sum(1 << i for i, b in enumerate(x) if b)"