mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-11 22:31:12 +02:00
* Moved function scm_string_hash to hash.c.
This commit is contained in:
parent
30eaf3ccd8
commit
ba3932579c
5 changed files with 29 additions and 24 deletions
|
@ -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>
|
2000-12-11 Marius Vollmer <mvo@zagadka.ping.de>
|
||||||
|
|
||||||
* gc_os_dep.c (scm_get_stack_base) [MSWIN32]: Added detection of
|
* gc_os_dep.c (scm_get_stack_base) [MSWIN32]: Added detection of
|
||||||
|
|
|
@ -61,6 +61,28 @@ extern double floor();
|
||||||
#endif
|
#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:: why downcase for characters? (2x: scm_hasher, scm_ihashv) */
|
||||||
/* Dirk:FIXME:: scm_hasher could be made static. */
|
/* Dirk:FIXME:: scm_hasher could be made static. */
|
||||||
|
|
||||||
|
|
|
@ -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 long scm_hasher (SCM obj, unsigned long n, scm_sizet d);
|
||||||
extern unsigned int scm_ihashq (SCM obj, unsigned int n);
|
extern unsigned int scm_ihashq (SCM obj, unsigned int n);
|
||||||
extern SCM scm_hashq (SCM obj, SCM n);
|
extern SCM scm_hashq (SCM obj, SCM n);
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
#include "libguile/_scm.h"
|
#include "libguile/_scm.h"
|
||||||
#include "libguile/chars.h"
|
#include "libguile/chars.h"
|
||||||
#include "libguile/eval.h"
|
#include "libguile/eval.h"
|
||||||
|
#include "libguile/hash.h"
|
||||||
#include "libguile/smob.h"
|
#include "libguile/smob.h"
|
||||||
#include "libguile/variable.h"
|
#include "libguile/variable.h"
|
||||||
#include "libguile/alist.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
|
/* scm_sym2vcell
|
||||||
* looks up the symbol in the symhash table.
|
* looks up the symbol in the symhash table.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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_mem2symbol (const char*, scm_sizet);
|
||||||
extern SCM scm_str2symbol (const char*);
|
extern SCM scm_str2symbol (const char*);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue