Fix ConcurrentReferenceHashMap max constraints

Update calculateShift to respect the maximum upper bound as well as the
minimum value.

Issue: SPR-11720
Merge pull request #513 from HejiaHo/master

* pull513:
  Fix ConcurrentReferenceHashMap max constraints