MCPcopy Create free account
hub / github.com/creatale/node-dv / l_hashFloat64ToUint64

Function l_hashFloat64ToUint64

deps/leptonica/src/utils1.c:653–664  ·  view source on GitHub ↗

! * \brief l_hashFloat64ToUint64() * * \param[in] nbuckets * \param[in] val * \param[out] phash hash value * \return 0 if OK, 1 on error * * * Notes: * (1) Simple, fast hash for using dnaHash with 64-bit data * (e.g., sets and histograms). * (2) The resulting hash is called a "key" in a lookup * operation. The bucket for %val in a dnaHash

Source from the content-addressed store, hash-verified

651 * </pre>
652 */
653l_int32
654l_hashFloat64ToUint64(l_int32 nbuckets,
655 l_float64 val,
656 l_uint64 *phash)
657{
658 PROCNAME("l_hashFloatToUint64");
659
660 if (!phash)
661 return ERROR_INT("&hash not defined", procName, 1);
662 *phash = (l_uint64)((21.732491 * nbuckets) * val);
663 return 0;
664}
665
666
667/*---------------------------------------------------------------------*

Callers 5

l_dnaHashCreateFromDnaFunction · 0.85
l_dnaRemoveDupsByHashFunction · 0.85
l_dnaMakeHistoByHashFunction · 0.85
l_dnaIntersectionByHashFunction · 0.85
l_dnaFindValByHashFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected