1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-10 14:00:21 +02:00

* Moved function scm_string_hash to hash.c.

This commit is contained in:
Dirk Herrmann 2000-12-12 13:57:26 +00:00
parent 30eaf3ccd8
commit ba3932579c
5 changed files with 29 additions and 24 deletions

View file

@ -1,3 +1,8 @@
2000-12-12 Dirk Herrmann <D.Herrmann@tu-bs.de>
* hash.[ch] (scm_string_hash), symbols.[ch] (scm_string_hash):
Moved function scm_string_hash to hash.c.
2000-12-11 Marius Vollmer <mvo@zagadka.ping.de>
* gc_os_dep.c (scm_get_stack_base) [MSWIN32]: Added detection of

View file

@ -61,6 +61,28 @@ extern double floor();
#endif
unsigned long
scm_string_hash (const unsigned char *str, scm_sizet len)
{
if (len > 5)
{
scm_sizet i = 5;
unsigned long h = 264;
while (i--)
h = (h << 8) + ((unsigned) (scm_downcase (str[h % len])));
return h;
}
else
{
scm_sizet i = len;
unsigned long h = 0;
while (i)
h = (h << 8) + ((unsigned) (scm_downcase (str[--i])));
return h;
}
}
/* Dirk:FIXME:: why downcase for characters? (2x: scm_hasher, scm_ihashv) */
/* Dirk:FIXME:: scm_hasher could be made static. */

View file

@ -48,6 +48,7 @@
extern unsigned long scm_string_hash (const unsigned char *str, scm_sizet len);
extern unsigned long scm_hasher (SCM obj, unsigned long n, scm_sizet d);
extern unsigned int scm_ihashq (SCM obj, unsigned int n);
extern SCM scm_hashq (SCM obj, SCM n);

View file

@ -48,6 +48,7 @@
#include "libguile/_scm.h"
#include "libguile/chars.h"
#include "libguile/eval.h"
#include "libguile/hash.h"
#include "libguile/smob.h"
#include "libguile/variable.h"
#include "libguile/alist.h"
@ -81,28 +82,6 @@ duplicate_string (const char * src, unsigned long length)
*/
unsigned long
scm_string_hash (const unsigned char *str, scm_sizet len)
{
if (len > 5)
{
scm_sizet i = 5;
unsigned long h = 264;
while (i--)
h = (h << 8) + ((unsigned) (scm_downcase (str[h % len])));
return h;
}
else
{
scm_sizet i = len;
unsigned long h = 0;
while (i)
h = (h << 8) + ((unsigned) (scm_downcase (str[--i])));
return h;
}
}
/* scm_sym2vcell
* looks up the symbol in the symhash table.
*/

View file

@ -71,8 +71,6 @@
extern unsigned long scm_string_hash (const unsigned char *str, scm_sizet len);
extern SCM scm_mem2symbol (const char*, scm_sizet);
extern SCM scm_str2symbol (const char*);