DCL 3.7.4
Loading...
Searching...
No Matches
HashFun.h File Reference
#include <dcl/String.h>

Go to the source code of this file.

Classes

struct  HashFun< TYPE >
struct  HashFun< String >
struct  HashFun< const wchar_t * >
struct  HashFun< wchar_t * >
struct  HashFun< ByteString >
struct  HashFun< const char * >
struct  HashFun< char * >
struct  HashFun< char >
struct  HashFun< unsigned char >
struct  HashFun< short >
struct  HashFun< unsigned short >
struct  HashFun< int >
struct  HashFun< unsigned int >
struct  HashFun< long >
struct  HashFun< unsigned long >
struct  HashFun< long long >
struct  HashFun< unsigned long long >
struct  HashFun< void * >
struct  HashFun< const void * >

Macros

#define __DCL_HASH_FUN_H__   20110303

Functions

unsigned int __wide_string_hashKey (const wchar_t *_psz)
unsigned int __byte_string_hashKey (const char *_psz)
DCLCAPI size_t DCLGetNextPrimNumber (size_t _n)

Macro Definition Documentation

◆ __DCL_HASH_FUN_H__

#define __DCL_HASH_FUN_H__   20110303

Definition at line 2 of file HashFun.h.

Function Documentation

◆ __byte_string_hashKey()

unsigned int __byte_string_hashKey ( const char * _psz)
inline

Definition at line 51 of file HashFun.h.

52{
53 unsigned int h = 0;
54 for( ; *_psz; _psz++) {
55 h = 5 * h + (unsigned char) *_psz;
56 }
57 return h;
58}

◆ __wide_string_hashKey()

unsigned int __wide_string_hashKey ( const wchar_t * _psz)
inline

Definition at line 15 of file HashFun.h.

16{
17 unsigned int h = 0;
18 for( ; *_psz; _psz++) {
19 h = 5 * h + (unsigned int) *_psz;
20 }
21 return h;
22}

◆ DCLGetNextPrimNumber()

DCLCAPI size_t DCLGetNextPrimNumber ( size_t _n)

Definition at line 23 of file HashFun.cpp.

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}
#define __countof(array, type)
Definition Config.h:336