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

This set of patches introduces a new tc7 code scm_tc7_number for

numbers.  Bignums, reals and complex numbers are turned from smobs
	into subtypes of scm_tc7_number.

	* tags.h (scm_tc7_number): New.

	* eq.c (scm_equal_p), eval.c (SCM_CEVAL), evalext.c
	(scm_self_evaluating_p), gc-card.c (scm_i_sweep_card), gc-mark.c
	(scm_gc_mark_dependencies), goops.c (create_smob_classes), hash.c
	(scm_hasher), numbers.c, numbers.h (SCM_NUMP), objects.c
	(scm_class_of), print.c (scm_iprin1), smob.c
	(scm_smob_prehistory): Don't handle bignums, reals and complex
	numbers as subtypes of scm_tc7_smob any more.

	* numbers.h, tags.h (scm_tc16_big, scm_tc16_real,
	scm_tc16_complex): Moved definitions from tags.h to numbers.h.
This commit is contained in:
Dirk Herrmann 2003-09-18 20:55:40 +00:00
parent 29c4382afd
commit 534c55a97d
14 changed files with 98 additions and 51 deletions

View file

@ -96,11 +96,11 @@ scm_hasher(SCM obj, unsigned long n, size_t d)
default:
return 263 % n;
case scm_tc7_smob:
return 263 % n;
case scm_tc7_number:
switch SCM_TYP16 (obj) {
case scm_tc16_big:
return SCM_INUM (scm_modulo (obj, SCM_MAKINUM (n)));
default:
return 263 % n;
case scm_tc16_real:
{
double r = SCM_REAL_VALUE (obj);
@ -110,9 +110,12 @@ scm_hasher(SCM obj, unsigned long n, size_t d)
return SCM_INUM (scm_modulo (obj, SCM_MAKINUM (n)));
}
}
/* Fall through */
case scm_tc16_complex:
obj = scm_number_to_string (obj, SCM_MAKINUM (10));
/* Fall through */
}
/* Fall through */
case scm_tc7_string:
return scm_string_hash (SCM_STRING_UCHARS (obj), SCM_STRING_LENGTH (obj)) % n;
case scm_tc7_symbol: