mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-24 02:24:46 +08:00
Moved the function hashname from stabsread.c to buildsym.c, since
it's a general-purpose function.
This commit is contained in:
parent
716f859496
commit
48f075eb2a
@ -1,3 +1,8 @@
|
||||
Mon Aug 9 16:45:00 1993 Stan Shebs (shebs@rtl.cygnus.com)
|
||||
|
||||
* stabsread.c, buildsym.c (hashname): Moved function to
|
||||
buildsym.c, as suggested in the sources.
|
||||
|
||||
Mon Aug 9 09:53:45 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
|
||||
|
||||
* remote-udi.c: Make udi_ops extern rather than trying forward
|
||||
|
@ -854,6 +854,37 @@ push_context (desc, valu)
|
||||
return (new);
|
||||
}
|
||||
|
||||
|
||||
/* Compute a small integer hash code for the given name. */
|
||||
|
||||
int
|
||||
hashname (name)
|
||||
char *name;
|
||||
{
|
||||
register char *p = name;
|
||||
register int total = p[0];
|
||||
register int c;
|
||||
|
||||
c = p[1];
|
||||
total += c << 2;
|
||||
if (c)
|
||||
{
|
||||
c = p[2];
|
||||
total += c << 4;
|
||||
if (c)
|
||||
{
|
||||
total += p[3] << 6;
|
||||
}
|
||||
}
|
||||
|
||||
/* Ensure result is positive. */
|
||||
if (total < 0)
|
||||
{
|
||||
total += (1000 << 6);
|
||||
}
|
||||
return (total % HASHSIZE);
|
||||
}
|
||||
|
||||
|
||||
/* Initialize anything that needs initializing when starting to read
|
||||
a fresh piece of a symbol file, e.g. reading in the stuff corresponding
|
||||
|
@ -216,38 +216,6 @@ static int undef_types_length;
|
||||
if (**(pp) == '\\') *(pp) = next_symbol_text (); \
|
||||
} while (0)
|
||||
|
||||
|
||||
/* This is used by other symbol readers besides stabs, so for cleanliness
|
||||
should probably be in buildsym.c. */
|
||||
|
||||
int
|
||||
hashname (name)
|
||||
char *name;
|
||||
{
|
||||
register char *p = name;
|
||||
register int total = p[0];
|
||||
register int c;
|
||||
|
||||
c = p[1];
|
||||
total += c << 2;
|
||||
if (c)
|
||||
{
|
||||
c = p[2];
|
||||
total += c << 4;
|
||||
if (c)
|
||||
{
|
||||
total += p[3] << 6;
|
||||
}
|
||||
}
|
||||
|
||||
/* Ensure result is positive. */
|
||||
if (total < 0)
|
||||
{
|
||||
total += (1000 << 6);
|
||||
}
|
||||
return (total % HASHSIZE);
|
||||
}
|
||||
|
||||
|
||||
/* Look up a dbx type-number pair. Return the address of the slot
|
||||
where the type for that number-pair is stored.
|
||||
|
Loading…
Reference in New Issue
Block a user