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

scm_hasher: Use symbolic names for the tc3 constants and some SCM usage

cleanups.
This commit is contained in:
Dirk Herrmann 2000-04-10 14:29:26 +00:00
parent 3da01fa367
commit dba97178b1
2 changed files with 21 additions and 11 deletions

View file

@ -1,3 +1,9 @@
2000-04-10 Dirk Herrmann <D.Herrmann@tu-bs.de>
* hash.c (scm_hasher): Use symbolic names for the tc3 constants.
Unpack SCM value to use it as a switch parameter. Don't cast SCM
values to int values.
2000-04-10 Mikael Djurfeldt <mdj@mdj.nada.kth.se>
* coop.c (mother): Handled EINTR (the wait has been interrupted by

View file

@ -59,29 +59,33 @@ extern double floor();
#endif
/* Dirk:FIXME:: why downcase for characters? (2x: scm_hasher, scm_ihashv) */
/* Dirk:FIXME:: scm_hasher could be made static. */
unsigned long
scm_hasher(SCM obj, unsigned long n, scm_sizet d)
{
switch (7 & (int) obj) {
case 2:
case 6:
switch (SCM_ITAG3 (obj)) {
case scm_tc3_int_1:
case scm_tc3_int_2:
return SCM_INUM(obj) % n; /* SCM_INUMP(obj) */
case 4:
if SCM_CHARP(obj)
case scm_tc3_imm24:
if (SCM_CHARP(obj))
return (unsigned)(scm_downcase(SCM_CHAR(obj))) % n;
switch ((int) obj) {
switch (SCM_UNPACK (obj)) {
#ifndef SICP
case (int) SCM_EOL:
case SCM_EOL:
d = 256;
break;
#endif
case (int) SCM_BOOL_T:
case SCM_BOOL_T:
d = 257;
break;
case (int) SCM_BOOL_F:
case SCM_BOOL_F:
d = 258;
break;
case (int) SCM_EOF_VAL:
case SCM_EOF_VAL:
d = 259;
break;
default:
@ -90,7 +94,7 @@ scm_hasher(SCM obj, unsigned long n, scm_sizet d)
return d % n;
default:
return 263 % n; /* perhaps should be error */
case 0:
case scm_tc3_cons:
switch SCM_TYP7(obj) {
default:
return 263 % n;