! * \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
| 651 | * </pre> |
| 652 | */ |
| 653 | l_int32 |
| 654 | l_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 | /*---------------------------------------------------------------------* |
no outgoing calls
no test coverage detected