@@ -338,61 +338,10 @@ Experimental
338
338
339
339
##### Description
340
340
341
- Calculates an ` nbits ` hash code from a 32 bit integer.
342
-
343
- ##### Syntax
344
-
345
- ` code = [[stdlib_hashmap_wrappers:fibonacci_hash]]( key, nbits ) `
346
-
347
- ##### Class
348
-
349
- Pure function
350
-
351
- ##### Arguments
352
-
353
- ` key ` : Shall be a scalar integer expression of kind ` int32 ` . It is an
354
- ` intent(in) ` argument.
355
-
356
- ` nbits ` Shall be a scalar default integer expression with `0 < nbits <
357
- 32` . It is an ` intent(in)` argument.
358
-
359
- ##### Result character
360
-
361
- The result is an integer of kind ` int32 ` .
362
-
363
- ##### Result value
364
-
365
- The result has at most the lowest ` nbits ` nonzero so it can serve as
366
- an index into the hash slots.
367
-
368
- ##### Note
369
-
370
- ` fibonacci_hash ` is an implementation of the Fibonacci Hash of Donald
371
- E. Knuth. It multiplies the ` KEY ` by the odd valued approximation to
372
- ` 2**32/phi ` , where ` phi ` is the golden ratio 1.618..., and returns the
373
- ` NBITS ` upper bits of the product as the lowest bits of the result.
374
-
375
-
376
- ##### Example
377
-
378
- ``` fortran
379
- program demo_fibonacci_hash
380
- use stdlib_hashmap_wrappers, only: &
381
- fibonacci_hash
382
- use iso_fortran_env, only: int32
383
- implicit none
384
- integer, allocatable :: array1(:)
385
- integer(int32) :: hash, source
386
- type(key_type) :: key
387
- allocate( array1(0:2**4-1) )
388
- array1(:) = 0
389
- source = int(Z'1FFFFFF', int32)
390
- hash = fibonacci_hash(source, 4)
391
- azray1(hash) = source
392
- print *, hash
393
- print *, array
394
- end program demo_fibonacci_hash
395
- ```
341
+ ` fibonacci_hash ` is just a re-export of the function of the same name
342
+ implemented in
343
+ [ ` stdlib_hash_32bit ` ] ( https://stdlib.fortran-lang.org/page/spec/stdlib_hash_functions.html#fibonacci_hash-maps-an-integer-to-a-smaller-number-of-bits ) .
344
+ It reduces the value of a 32 bit integer to a smaller number of bits.
396
345
397
346
398
347
#### ` fnv_1_hasher ` - calculates a hash code from a key
0 commit comments