Diff
Not logged in

Differences From Artifact [f61ff71afc]:

To Artifact [4320aaa63a]:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
 * tclHash.c --
 *
 *	Implementation of in-memory hash tables for Tcl and Tcl-based
 *	applications.
 *
 * Copyright (c) 1991-1993 The Regents of the University of California.
 * Copyright (c) 1994 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclHash.c,v 1.40 2010/02/07 09:10:33 dkf Exp $
 */

#include "tclInt.h"

/*
 * Prevent macros from clashing with function definitions.
 */












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
 * tclHash.c --
 *
 *	Implementation of in-memory hash tables for Tcl and Tcl-based
 *	applications.
 *
 * Copyright (c) 1991-1993 The Regents of the University of California.
 * Copyright (c) 1994 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclHash.c,v 1.41 2010/02/09 22:39:11 dkf Exp $
 */

#include "tclInt.h"

/*
 * Prevent macros from clashing with function definitions.
 */
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
 */

static unsigned
HashStringKey(
    Tcl_HashTable *tablePtr,	/* Hash table. */
    void *keyPtr)		/* Key from which to compute hash value. */
{
    register const char *string = (const char *) keyPtr;
    register unsigned result = 0;
    register int c;

    /*
     * This is the (32-bit) Fowler/Noll/Vo hash algorithm. This has the
     * property of being a reasonably good non-cryptographic hash function for
     * short string words, i.e., virtually all command and namespace names. It
     * is also faster than Tcl's original algorithm on Intel x86, where there
     * is a fast built-in multiply assembly instruction.







|
|
|







867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
 */

static unsigned
HashStringKey(
    Tcl_HashTable *tablePtr,	/* Hash table. */
    void *keyPtr)		/* Key from which to compute hash value. */
{
    const unsigned char *string = keyPtr;
    unsigned result = 0;
    unsigned c;

    /*
     * This is the (32-bit) Fowler/Noll/Vo hash algorithm. This has the
     * property of being a reasonably good non-cryptographic hash function for
     * short string words, i.e., virtually all command and namespace names. It
     * is also faster than Tcl's original algorithm on Intel x86, where there
     * is a fast built-in multiply assembly instruction.