1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-27 07:42:10 +03:00

Re-apply Darren's char2-16 removal code.

This commit is contained in:
Bruce Momjian
1998-04-26 04:12:15 +00:00
parent 9260d4b440
commit 0d203b745d
63 changed files with 342 additions and 1341 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.8 1998/04/07 18:09:46 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.9 1998/04/26 04:05:08 momjian Exp $
*
* NOTES
* These functions are stored in pg_amproc. For each operator class
@@ -133,6 +133,8 @@ hashoid(Oid key)
return ((uint32) ~key);
}
#define PRIME1 37
#define PRIME2 1048583
uint32
hashchar(char key)
@@ -140,12 +142,8 @@ hashchar(char key)
int len;
uint32 h;
len = sizeof(char);
#define PRIME1 37
#define PRIME2 1048583
h = 0;
len = sizeof(char);
/* Convert char to integer */
h = h * PRIME1 ^ (key - ' ');
h %= PRIME2;
@@ -153,55 +151,6 @@ hashchar(char key)
return (h);
}
uint32
hashchar2(uint16 intkey)
{
uint32 h;
int len;
char *key = (char *) &intkey;
h = 0;
len = sizeof(uint16);
/* Convert string to integer */
while (len--)
h = h * PRIME1 ^ (*key++ - ' ');
h %= PRIME2;
return (h);
}
uint32
hashchar4(uint32 intkey)
{
uint32 h;
int len;
char *key = (char *) &intkey;
h = 0;
len = sizeof(uint32);
/* Convert string to integer */
while (len--)
h = h * PRIME1 ^ (*key++ - ' ');
h %= PRIME2;
return (h);
}
uint32
hashchar8(char *key)
{
uint32 h;
int len;
h = 0;
len = sizeof(char8);
/* Convert string to integer */
while (len--)
h = h * PRIME1 ^ (*key++ - ' ');
h %= PRIME2;
return (h);
}
uint32
hashname(NameData *n)
@@ -223,22 +172,6 @@ hashname(NameData *n)
}
uint32
hashchar16(char *key)
{
uint32 h;
int len;
h = 0;
len = sizeof(char16);
/* Convert string to integer */
while (len--)
h = h * PRIME1 ^ (*key++ - ' ');
h %= PRIME2;
return (h);
}
/*
* (Comment from the original db3 hashing code: )