Get the bucket and image indexes corresponding to the given key.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(hash_table), | intent(in) | :: | self | The hash table. |
||
class(*), | intent(in) | :: | key | The key. |
||
integer(kind=I4P), | intent(out) | :: | bucket | Bucket index. |
||
integer(kind=I4P), | intent(out) | :: | image | Image index. |
pure subroutine get_bucket_image_indexes(self, key, bucket, image)
!---------------------------------------------------------------------------------------------------------------------------------
!< Get the bucket and image indexes corresponding to the given key.
!---------------------------------------------------------------------------------------------------------------------------------
class(hash_table), intent(in) :: self !< The hash table.
class(*), intent(in) :: key !< The key.
integer(I4P), intent(out) :: bucket !< Bucket index.
integer(I4P), intent(out) :: image !< Image index.
!---------------------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------------
bucket = self%hash(key=key)
image = 1
if (self%images_number>1) then
image = mod(bucket, self%images_number) + 1
endif
!---------------------------------------------------------------------------------------------------------------------------------
endsubroutine get_bucket_image_indexes