2021-10-11 19:38:01 -03:00

39 lines
722 B
C
Executable File

/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#pragma ident "@(#)hash.c 1.4 92/07/17 SMI" /* SVr4.0 1.4 */
/*LINTLIBRARY*/
#ifdef __STDC__
#pragma weak elf_hash = _elf_hash
#endif
#include "syn.h"
#include "libelf.h"
#define MASK (~(unsigned long)0<<28)
unsigned long
elf_hash(name)
const char *name;
{
register unsigned long g, h = 0;
register const unsigned char *nm = (unsigned char *)name;
while (*nm != '\0') {
h = (h << 4) + *nm++;
if ((g = h & MASK) != 0)
h ^= g >> 24;
h &= ~MASK;
}
return h;
}