support legacy mode for hyperloglog. New non-legacy way is to calculate the rank before the index, to better support shrinking of hyperloglog