Speed up low-level C++ entropy computation

DO NOT MERGE until stricter entropy tests are in place.