A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-July/005994.html below:

[Python-Dev] new unicode hash calculation

[Python-Dev] new unicode hash calculation [Python-Dev] new unicode hash calculationFredrik Lundh Fredrik Lundh" <effbot@telia.com
Mon, 10 Jul 2000 19:07:15 +0200
mal wrote:

> * change hash value calculation to work on the Py_UNICODE data
>   instead of creating a default encoded cached object (what
>   now is .utf8str)

it this what you had in mind?

static long
unicode_hash(PyUnicodeObject *self)
{
    register int len;
    register Py_UNICODE *p;
    register long x;

    if (self->hash !=3D -1)
        return self->hash;
    len =3D PyUnicode_GET_SIZE(self);
    p =3D PyUnicode_AS_UNICODE(self);
    x =3D *p << 7;
    while (--len >=3D 0)
        x =3D (1000003*x) ^ *p++;
    x ^=3D a->ob_size;
    if (x =3D=3D -1)
        x =3D -2;
    self->hash =3D x;
    return x;
}

</F>




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4