… | |
… | |
1081 | |
1081 | |
1082 | /* ========== oblist implementation ========== */ |
1082 | /* ========== oblist implementation ========== */ |
1083 | |
1083 | |
1084 | #ifndef USE_OBJECT_LIST |
1084 | #ifndef USE_OBJECT_LIST |
1085 | |
1085 | |
|
|
1086 | static int |
1086 | static int hash_fn (const char *key, int table_size); |
1087 | hash_fn (const char *key, int table_size) |
|
|
1088 | { |
|
|
1089 | const unsigned char *p = key; |
|
|
1090 | uint32_t hash = 2166136261; |
|
|
1091 | |
|
|
1092 | while (*p) |
|
|
1093 | hash = (hash ^ *p++) * 16777619; |
|
|
1094 | |
|
|
1095 | return hash % table_size; |
|
|
1096 | } |
1087 | |
1097 | |
1088 | static pointer |
1098 | static pointer |
1089 | oblist_initial_value (SCHEME_P) |
1099 | oblist_initial_value (SCHEME_P) |
1090 | { |
1100 | { |
1091 | return mk_vector (SCHEME_A_ 461); /* probably should be bigger */ |
1101 | return mk_vector (SCHEME_A_ 461); /* probably should be bigger */ |
… | |
… | |
2811 | #define is_true(p) ((p) != S_F) |
2821 | #define is_true(p) ((p) != S_F) |
2812 | #define is_false(p) ((p) == S_F) |
2822 | #define is_false(p) ((p) == S_F) |
2813 | |
2823 | |
2814 | /* ========== Environment implementation ========== */ |
2824 | /* ========== Environment implementation ========== */ |
2815 | |
2825 | |
2816 | #if !defined(USE_ALIST_ENV) || !defined(USE_OBJECT_LIST) |
|
|
2817 | |
|
|
2818 | static int |
|
|
2819 | hash_fn (const char *key, int table_size) |
|
|
2820 | { |
|
|
2821 | const unsigned char *p = key; |
|
|
2822 | uint32_t hash = 2166136261; |
|
|
2823 | |
|
|
2824 | while (*p) |
|
|
2825 | hash = (hash ^ *p++) * 16777619; |
|
|
2826 | |
|
|
2827 | return hash % table_size; |
|
|
2828 | } |
|
|
2829 | #endif |
|
|
2830 | |
|
|
2831 | #ifndef USE_ALIST_ENV |
2826 | #ifndef USE_ALIST_ENV |
2832 | |
2827 | |
2833 | /* |
2828 | /* |
2834 | * In this implementation, each frame of the environment may be |
2829 | * In this implementation, each frame of the environment may be |
2835 | * a hash table: a vector of alists hashed by variable name. |
2830 | * a hash table: a vector of alists hashed by variable name. |
… | |
… | |
2857 | sym_hash (pointer sym, uint32_t size) |
2852 | sym_hash (pointer sym, uint32_t size) |
2858 | { |
2853 | { |
2859 | uintptr_t ptr = (uintptr_t)sym; |
2854 | uintptr_t ptr = (uintptr_t)sym; |
2860 | |
2855 | |
2861 | #if 0 |
2856 | #if 0 |
2862 | /* tqable size is prime, so why mix */ |
2857 | /* table size is prime, so why mix */ |
2863 | ptr += ptr >> 32; |
2858 | ptr += ptr >> 32; |
2864 | ptr += ptr >> 16; |
2859 | ptr += ptr >> 16; |
2865 | ptr += ptr >> 8; |
2860 | ptr += ptr >> 8; |
2866 | #endif |
2861 | #endif |
2867 | |
2862 | |