direct_lookup Subroutine

private subroutine direct_lookup(this, hval, index, pos, t_found)

Look up a value in this hash table. Returns whether the value is stored and if yes, where @param[in] hval hash value of the index to look up @param[in] index value to be looked up @param[out] pos on return, the position of index if found, else 0 @param[out] t_found on return, true if and only if index was found

Type Bound

shared_rhash_t

Arguments

Type IntentOptional Attributes Name
class(shared_rhash_t), intent(in) :: this
integer(kind=int64), intent(in) :: hval
integer(kind=int64), intent(in) :: index
integer(kind=int64), intent(out) :: pos
logical, intent(out) :: t_found

Contents

Source Code


Source Code

    subroutine direct_lookup(this, hval, index, pos, t_found)
        class(shared_rhash_t), intent(in) :: this
        integer(int64), intent(in) :: index, hval
        integer(int64), intent(out) :: pos
        logical, intent(out) :: t_found

        integer(int64) :: lower, upper, i

        lower = this%hval_offsets%ptr(hval) + 1
        upper = this%hval_offsets%ptr(hval + 1)

        t_found = .false.
        pos = 0
        do i = lower, upper
            if (this%indices%ptr(i) == index) then
                pos = i
                t_found = .true.
                return
            end if
        end do
    end subroutine direct_lookup