File: example_hashmaps_hasher_fun.f90

package info (click to toggle)
fortran-stdlib 0.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 34,008 kB
  • sloc: f90: 24,178; ansic: 1,244; cpp: 623; python: 119; makefile: 13
file content (14 lines) | stat: -rw-r--r-- 496 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
program example_hasher_fun
  use stdlib_hashmap_wrappers, only: fnv_1a_hasher, hasher_fun, set, key_type
  use stdlib_kinds, only: int8, int32
  implicit none
  procedure(hasher_fun), pointer :: hasher_pointer
  integer(int8), allocatable :: array1(:)
  integer(int32) :: hash
  type(key_type) :: key
  hasher_pointer => fnv_1a_hasher
  array1 = [5_int8, 4_int8, 3_int8, 1_int8, 10_int8, 4_int8]
  call set(key, array1)
  hash = hasher_pointer(key)
  print *, hash
end program example_hasher_fun