BloombergLP::bslalg::HashTableImpUtil::computeBucketIndex

Return the bucket index for the specified hashCode.

Synopsis

Declared in <bslalg_hashtableimputil.h>

static
std::size_t
computeBucketIndex(
    std::size_t hashCode,
    std::size_t numBuckets);

Description

Return the index of the bucket referring to the elements whose adjusted hash codes are the same as the adjusted value of the specified hashCode, where hashCode (and the hash-codes of the elements) are adjusted for the specified numBuckets. The behavior is undefined if numBuckets is 0.

Return Value

index of the bucket for the adjusted hashCode

Parameters

NameDescription
hashCodenon-adjusted hash code to map onto a bucket
numBucketsnumber of buckets in the table; must not be 0