For ENG-4396 and friends, add comments a fix some bugs in the C++ hash to partition function.