DCL 4.0
Loading...
Searching...
No Matches
HashFun.cpp
Go to the documentation of this file.
1#include <dcl/Object.h>
2#include <dcl/HashFun.h>
3
4/*
5#if __DCL_DEBUG
6#undef __THIS_FILE__
7static const char* __THIS_FILE__ = "dcl/core/CollectionBase.cpp";
8#endif
9*/
10
11__DCL_BEGIN_NAMESPACE
12
13static const size_t __prim_numbers[] =
14{
15 13, 23, 53, 97, 193,
16 389, 769, 1543, 3079, 6151,
17 12289, 24593, 49157, 98317, 196613,
18 393241, 786433, 1572869, 3145739, 6291469,
19 12582917, 25165843, 50331653, 100663319, 201326611,
20 402653189, 805306457, 1610612741
21};
22
24{
25 size_t n = __countof(__prim_numbers, size_t);
26 for(size_t i = 0; i < n; i++)
27 {
28 if (_n < __prim_numbers[i])
29 return __prim_numbers[i];
30 }
31 return __prim_numbers[n - 1];
32}
33
34__DCL_END_NAMESPACE
35
#define __countof(array, type)
Definition Config.h:365
#define DCLCAPI
Definition Config.h:100
DCLCAPI size_t DCLGetNextPrimNumber(size_t _n)
Definition HashFun.cpp:23
void CharsetConvertException *size_t n
Definition SQLField.cpp:253