~ubuntu-branches/ubuntu/lucid/w3m/lucid-proposed

« back to all changes in this revision

Viewing changes to hash.c

  • Committer: Bazaar Package Importer
  • Author(s): Fumitoshi UKAI
  • Date: 2004-04-29 03:28:41 UTC
  • Revision ID: james.westby@ubuntu.com-20040429032841-uo4mu7a813aqrua8
Tags: upstream-0.5.1
ImportĀ upstreamĀ versionĀ 0.5.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: hash.c,v 1.5 2003/04/07 16:27:10 ukai Exp $ */
 
2
#include <string.h>
 
3
#include "hash.h"
 
4
#include <gc.h>
 
5
 
 
6
static unsigned int
 
7
hashfunc(char *s)
 
8
{
 
9
    unsigned int h = 0;
 
10
    while (*s) {
 
11
        if (h & 0x80000000) {
 
12
            h <<= 1;
 
13
            h |= 1;
 
14
        }
 
15
        else
 
16
            h <<= 1;
 
17
        h += *s;
 
18
        s++;
 
19
    }
 
20
    return h;
 
21
}
 
22
 
 
23
#define keycomp(x,y) !strcmp(x,y)
 
24
 
 
25
/* *INDENT-OFF* */
 
26
defhashfunc(char *, int, si)
 
27
defhashfunc(char *, char *, ss)
 
28
defhashfunc(char *, void *, sv)
 
29
defhashfunc_i(int, void *, iv)
 
30
/* *INDENT-ON* */