string hashcodes are fixnums
parent
9901fbdc28
commit
75c85db354
|
@ -6,7 +6,6 @@
|
|||
- index.html
|
||||
- if a directory is requested and URL does not end with /, redirect
|
||||
- minimize stage2 initialization code, just move it to source files
|
||||
_ push call/allot counts as ulong bignums
|
||||
|
||||
+ bignums:
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "factor.h"
|
||||
|
||||
CELL tag_fixnum_or_bignum(FIXNUM x)
|
||||
CELL tag_integer(FIXNUM x)
|
||||
{
|
||||
if(x < FIXNUM_MIN || x > FIXNUM_MAX)
|
||||
return tag_object(s48_long_to_bignum(x));
|
||||
|
@ -8,6 +8,14 @@ CELL tag_fixnum_or_bignum(FIXNUM x)
|
|||
return tag_fixnum(x);
|
||||
}
|
||||
|
||||
CELL tag_unsigned_integer(CELL x)
|
||||
{
|
||||
if(x > FIXNUM_MAX)
|
||||
return tag_object(s48_ulong_to_bignum(x));
|
||||
else
|
||||
return tag_fixnum(x);
|
||||
}
|
||||
|
||||
CELL upgraded_arithmetic_type(CELL type1, CELL type2)
|
||||
{
|
||||
switch(type1)
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
CELL upgraded_arithmetic_type(CELL type1, CELL type2);
|
||||
|
||||
CELL tag_fixnum_or_bignum(FIXNUM x);
|
||||
CELL tag_integer(FIXNUM x);
|
||||
CELL tag_unsigned_integer(CELL x);
|
||||
|
||||
#define BINARY_OP(OP) \
|
||||
CELL OP(CELL x, CELL y) \
|
||||
|
|
|
@ -40,12 +40,12 @@ CELL number_eq_fixnum(FIXNUM x, FIXNUM y)
|
|||
|
||||
CELL add_fixnum(FIXNUM x, FIXNUM y)
|
||||
{
|
||||
return tag_fixnum_or_bignum(x + y);
|
||||
return tag_integer(x + y);
|
||||
}
|
||||
|
||||
CELL subtract_fixnum(FIXNUM x, FIXNUM y)
|
||||
{
|
||||
return tag_fixnum_or_bignum(x - y);
|
||||
return tag_integer(x - y);
|
||||
}
|
||||
|
||||
CELL multiply_fixnum(FIXNUM x, FIXNUM y)
|
||||
|
@ -59,7 +59,7 @@ CELL multiply_fixnum(FIXNUM x, FIXNUM y)
|
|||
|
||||
CELL divint_fixnum(FIXNUM x, FIXNUM y)
|
||||
{
|
||||
return tag_fixnum_or_bignum(x / y);
|
||||
return tag_integer(x / y);
|
||||
}
|
||||
|
||||
CELL divfloat_fixnum(FIXNUM x, FIXNUM y)
|
||||
|
@ -69,8 +69,8 @@ CELL divfloat_fixnum(FIXNUM x, FIXNUM y)
|
|||
|
||||
CELL divmod_fixnum(FIXNUM x, FIXNUM y)
|
||||
{
|
||||
dpush(tag_fixnum_or_bignum(x / y));
|
||||
return tag_fixnum_or_bignum(x % y);
|
||||
dpush(tag_integer(x / y));
|
||||
return tag_integer(x % y);
|
||||
}
|
||||
|
||||
CELL mod_fixnum(FIXNUM x, FIXNUM y)
|
||||
|
@ -125,12 +125,12 @@ CELL divide_fixnum(FIXNUM x, FIXNUM y)
|
|||
}
|
||||
|
||||
if(y == 1)
|
||||
return tag_fixnum_or_bignum(x);
|
||||
return tag_integer(x);
|
||||
else
|
||||
{
|
||||
return tag_ratio(ratio(
|
||||
tag_fixnum_or_bignum(x),
|
||||
tag_fixnum_or_bignum(y)));
|
||||
tag_integer(x),
|
||||
tag_integer(y)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -104,8 +104,8 @@ bool in_zone(ZONE* z, CELL pointer)
|
|||
void primitive_room(void)
|
||||
{
|
||||
/* push: free total */
|
||||
dpush(tag_fixnum_or_bignum(active->limit - active->here));
|
||||
dpush(tag_fixnum_or_bignum(active->limit - active->base));
|
||||
dpush(tag_integer(active->limit - active->here));
|
||||
dpush(tag_integer(active->limit - active->base));
|
||||
}
|
||||
|
||||
void primitive_allot_profiling(void)
|
||||
|
|
|
@ -428,7 +428,7 @@ s48_bignum_to_long(bignum_type bignum)
|
|||
}
|
||||
|
||||
bignum_type
|
||||
ulong_to_bignum(unsigned long n)
|
||||
s48_ulong_to_bignum(unsigned long n)
|
||||
{
|
||||
bignum_digit_type result_digits [BIGNUM_DIGITS_FOR_LONG];
|
||||
bignum_digit_type * end_digits = result_digits;
|
||||
|
|
|
@ -164,8 +164,7 @@ void primitive_string_eq(void)
|
|||
|
||||
void primitive_string_hashcode(void)
|
||||
{
|
||||
drepl(tag_object(s48_long_to_bignum(
|
||||
untag_string(dpeek())->hashcode)));
|
||||
drepl(tag_fixnum(untag_string(dpeek())->hashcode));
|
||||
}
|
||||
|
||||
CELL index_of_ch(CELL index, STRING* string, CELL ch)
|
||||
|
|
|
@ -78,7 +78,7 @@ void primitive_set_word_plist(void)
|
|||
|
||||
void primitive_word_call_count(void)
|
||||
{
|
||||
drepl(tag_fixnum(untag_word(dpeek())->call_count));
|
||||
drepl(tag_unsigned_integer(untag_word(dpeek())->call_count));
|
||||
}
|
||||
|
||||
void primitive_set_word_call_count(void)
|
||||
|
@ -89,7 +89,7 @@ void primitive_set_word_call_count(void)
|
|||
|
||||
void primitive_word_allot_count(void)
|
||||
{
|
||||
drepl(tag_fixnum(untag_word(dpeek())->allot_count));
|
||||
drepl(tag_unsigned_integer(untag_word(dpeek())->allot_count));
|
||||
}
|
||||
|
||||
void primitive_set_word_allot_count(void)
|
||||
|
|
Loading…
Reference in New Issue