summaryrefslogtreecommitdiff
path: root/src/qhash.cc
blob: cec9adf0d46eaa194ce004c2a5f2c99ee125f8c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "myqhash.h"

static uint hash(const uchar *p, int n)
{
    uint h = 0;
    uint g;

    while (n--) {
        h = (h << 4) + *p++;
        if ((g = (h & 0xf0000000)) != 0)
            h ^= g >> 23;
        h &= ~g;
    }
    return h;
}

uint qHash(const std::string &str) {
	return hash(reinterpret_cast<const uchar *>(str.c_str()), str.length());
}
contact: Jan Huwald // Impressum