#define SYMBOL_STRINGBUF SCM_CELL_OBJECT_1
SCM
-scm_i_make_symbol (SCM name, unsigned long hash, SCM props)
+scm_i_make_symbol (SCM name, scm_t_bits flags,
+ unsigned long hash, SCM props)
{
SCM buf;
size_t start = STRING_START (name);
STRINGBUF_CHARS (buf) + start, length);
buf = new_buf;
}
- return scm_double_cell (scm_tc7_symbol, SCM_UNPACK (buf),
+ return scm_double_cell (scm_tc7_symbol | flags, SCM_UNPACK (buf),
(scm_t_bits) hash, SCM_UNPACK (props));
}
/* internal functions related to symbols. */
-SCM_API SCM scm_i_make_symbol (SCM name, unsigned long hash, SCM props);
+SCM_API SCM scm_i_make_symbol (SCM name, scm_t_bits flags,
+ unsigned long hash, SCM props);
SCM_API const char *scm_i_symbol_chars (SCM sym);
SCM_API size_t scm_i_symbol_length (SCM sym);
SCM_API SCM scm_i_symbol_substring (SCM sym, size_t start, size_t end);
const char *name = scm_i_string_chars (str);
size_t len = scm_i_string_length (str);
- size_t raw_hash = scm_string_hash ((const unsigned char *) name, len) / 2;
+ size_t raw_hash = scm_string_hash ((const unsigned char *) name, len);
size_t hash = raw_hash % SCM_HASHTABLE_N_BUCKETS (symbols);
{
{
/* The symbol was not found - create it. */
- SCM symbol = scm_i_make_symbol (str, raw_hash,
+ SCM symbol = scm_i_make_symbol (str, 0, raw_hash,
scm_cons (SCM_BOOL_F, SCM_EOL));
SCM slot = SCM_HASHTABLE_BUCKETS (symbols) [hash];
{
const char *name = scm_i_string_chars (str);
size_t len = scm_i_string_length (str);
+ size_t raw_hash = scm_string_hash ((const unsigned char *) name, len);
- size_t raw_hash = (scm_string_hash ((const unsigned char *) name, len)/2
- + SCM_T_BITS_MAX/2 + 1);
-
- return scm_i_make_symbol (str, raw_hash,
- scm_cons (SCM_BOOL_F, SCM_EOL));
+ return scm_i_make_symbol (str, SCM_I_F_SYMBOL_UNINTERNED,
+ raw_hash, scm_cons (SCM_BOOL_F, SCM_EOL));
}
SCM_DEFINE (scm_symbol_p, "symbol?", 1, 0, 0,
#define scm_is_symbol(x) (!SCM_IMP (x) \
&& (SCM_TYP7 (x) == scm_tc7_symbol))
#define scm_i_symbol_hash(x) ((unsigned long) SCM_CELL_WORD_2 (x))
-#define scm_i_symbol_is_interned(x) (scm_i_symbol_hash(x)<=(SCM_T_BITS_MAX/2))
+#define scm_i_symbol_is_interned(x) \
+ (!(SCM_CELL_WORD_0 (x) & SCM_I_F_SYMBOL_UNINTERNED))
+
+#define SCM_I_F_SYMBOL_UNINTERNED 0x100
\f