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

Type Bound

shared_rhash_t

Arguments

Type IntentOptional Attributes Name
class(shared_rhash_t), intent(in) :: this
integer(kind=int64), intent(in) :: hval

value to be looked up hash value of the index to look up

integer(kind=int64), intent(in) :: index

value to be looked up

integer(kind=int64), intent(out) :: pos

on return, the position of index if found, else 0

logical, intent(out) :: t_found

on return, true if and only if index was found


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