X-Git-Url: https://git.cworth.org/git?p=tar;a=blobdiff_plain;f=gnu%2Fhash-pjw.c;fp=gnu%2Fhash-pjw.c;h=0000000000000000000000000000000000000000;hp=eac00c65601b70565ea187bb1a25f79acc9c2417;hb=ee168310ec4227174ace489bf5f81f8c2f91cde0;hpb=22f1eb8bc17e5be72dd23d42d6aaa60196ac22e6 diff --git a/gnu/hash-pjw.c b/gnu/hash-pjw.c deleted file mode 100644 index eac00c6..0000000 --- a/gnu/hash-pjw.c +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- buffer-read-only: t -*- vi: set ro: */ -/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ -/* hash-pjw.c -- compute a hash value from a NUL-terminated string. - - Copyright (C) 2001, 2003, 2006, 2009-2010 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#include - -#include "hash-pjw.h" - -#include - -#define SIZE_BITS (sizeof (size_t) * CHAR_BIT) - -/* A hash function for NUL-terminated char* strings using - the method described by Bruno Haible. - See http://www.haible.de/bruno/hashfunc.html. */ - -size_t -hash_pjw (const void *x, size_t tablesize) -{ - const char *s; - size_t h = 0; - - for (s = x; *s; s++) - h = *s + ((h << 9) | (h >> (SIZE_BITS - 9))); - - return h % tablesize; -}