probe_free Function

private function probe_free(this, key) result(bucket)

First empty bucket in the probe sequence of key. The load factor keeps at least one bucket empty at all times, so this always finds one.

Arguments

Type IntentOptional Attributes Name
class(hash_map_t), intent(in) :: this
character(len=*), intent(in) :: key

Return Value integer(kind=default_int)


Calls

proc~~probe_free~~CallsGraph proc~probe_free probe_free proc~home_bucket home_bucket proc~probe_free->proc~home_bucket interface~fnv_1a_hash fnv_1a_hash proc~home_bucket->interface~fnv_1a_hash

Called by

proc~~probe_free~~CalledByGraph proc~probe_free probe_free proc~hash_map_insert hash_map_t%hash_map_insert proc~hash_map_insert->proc~probe_free proc~grow_buckets grow_buckets proc~hash_map_insert->proc~grow_buckets proc~rebuild_buckets rebuild_buckets proc~rebuild_buckets->proc~probe_free proc~grow_buckets->proc~rebuild_buckets proc~hash_map_remove hash_map_t%hash_map_remove proc~hash_map_remove->proc~rebuild_buckets

Variables

Type Visibility Attributes Name Initial
integer(kind=default_int), private :: probe

Source Code

   function probe_free(this, key) result(bucket)
      !! First empty bucket in the probe sequence of `key`. The load factor
      !! keeps at least one bucket empty at all times, so this always finds
      !! one.
      class(hash_map_t), intent(in) :: this
      character(len=*), intent(in) :: key
      integer(default_int) :: bucket

      integer(default_int) :: probe

      bucket = home_bucket(this, key)
      do probe = 1, this%n_buckets
         if (this%buckets(bucket) == BUCKET_EMPTY) return
         bucket = bucket + 1
         if (bucket > this%n_buckets) bucket = 1
      end do
   end function probe_free