Mercurial > hg > xemacs-beta
comparison src/elhash.c @ 5581:56144c8593a8
Mechanically change INT to FIXNUM in our sources.
src/ChangeLog addition:
2011-10-09 Aidan Kehoe <kehoea@parhasard.net>
[...]
Mechanically change INT (where it refers to non-bignum Lisp
integers) to FIXNUM in our sources. Done for the following
functions, enums, and macros: Lisp_Type_Int_Even,
Lisp_Type_Int_Odd, INT_GCBITS, INT_VALBITS, make_int(), INTP(),
XINT(), CHECK_INT(), XREALINT(), INT_PLUS(), INT_MINUS(),
EMACS_INT_MAX (to MOST_POSITIVE_FIXNUM), EMACS_INT_MIN (to
MOST_NEGATIVE_FIXNUM), NUMBER_FITS_IN_AN_EMACS_INT() to
NUMBER_FITS_IN_A_FIXNUM(), XFLOATINT, XCHAR_OR_INT, INT_OR_FLOAT.
The EMACS_INT typedef was not changed, it does not describe
non-bignum Lisp integers.
Script that did the change available in
http://mid.gmane.org/20067.17650.181273.12014@parhasard.net .
modules/ChangeLog addition:
2011-10-09 Aidan Kehoe <kehoea@parhasard.net>
[...]
Mechanically change INT to FIXNUM, where the usage describes non-bignum
Lisp integers. See the src/ChangeLog entry for more details.
man/ChangeLog addition:
2011-10-09 Aidan Kehoe <kehoea@parhasard.net>
* internals/internals.texi (How Lisp Objects Are Represented in C):
* internals/internals.texi (Integers and Characters):
Mechanically change INT to FIXNUM, where the usage describes non-bignum
Lisp integers.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 09 Oct 2011 09:51:57 +0100 |
parents | 58b38d5b32d0 |
children | 3192994c49ca |
comparison
equal
deleted
inserted
replaced
5580:a0e81357194e | 5581:56144c8593a8 |
---|---|
287 GCPRO1 (args[0]); | 287 GCPRO1 (args[0]); |
288 gcpro1.nvars = countof (args); | 288 gcpro1.nvars = countof (args); |
289 res = IGNORE_MULTIPLE_VALUES (Ffuncall (countof (args), args)); | 289 res = IGNORE_MULTIPLE_VALUES (Ffuncall (countof (args), args)); |
290 UNGCPRO; | 290 UNGCPRO; |
291 | 291 |
292 if (INTP (res)) | 292 if (FIXNUMP (res)) |
293 { | 293 { |
294 return (Hashcode) (XINT (res)); | 294 return (Hashcode) (XFIXNUM (res)); |
295 } | 295 } |
296 | 296 |
297 #ifdef HAVE_BIGNUM | 297 #ifdef HAVE_BIGNUM |
298 if (BIGNUMP (res)) | 298 if (BIGNUMP (res)) |
299 { | 299 { |
818 if (BIGNUMP (value)) | 818 if (BIGNUMP (value)) |
819 { | 819 { |
820 /* hash_table_size() can't handle excessively large sizes. */ | 820 /* hash_table_size() can't handle excessively large sizes. */ |
821 maybe_signal_error_1 (Qargs_out_of_range, | 821 maybe_signal_error_1 (Qargs_out_of_range, |
822 list3 (value, Qzero, | 822 list3 (value, Qzero, |
823 make_integer (EMACS_INT_MAX)), | 823 make_integer (MOST_POSITIVE_FIXNUM)), |
824 Qhash_table, errb); | 824 Qhash_table, errb); |
825 return 0; | 825 return 0; |
826 } | 826 } |
827 else | 827 else |
828 { | 828 { |
839 } | 839 } |
840 | 840 |
841 static Elemcount | 841 static Elemcount |
842 decode_hash_table_size (Lisp_Object obj) | 842 decode_hash_table_size (Lisp_Object obj) |
843 { | 843 { |
844 return NILP (obj) ? HASH_TABLE_DEFAULT_SIZE : XINT (obj); | 844 return NILP (obj) ? HASH_TABLE_DEFAULT_SIZE : XFIXNUM (obj); |
845 } | 845 } |
846 | 846 |
847 static int | 847 static int |
848 hash_table_weakness_validate (Lisp_Object UNUSED (keyword), Lisp_Object value, | 848 hash_table_weakness_validate (Lisp_Object UNUSED (keyword), Lisp_Object value, |
849 Error_Behavior errb) | 849 Error_Behavior errb) |
1371 LINEAR_PROBING_LOOP (probe, entries, ht->size) | 1371 LINEAR_PROBING_LOOP (probe, entries, ht->size) |
1372 if (EQ (probe->key, key)) | 1372 if (EQ (probe->key, key)) |
1373 break; | 1373 break; |
1374 | 1374 |
1375 if (!HTENTRY_CLEAR_P (probe)) | 1375 if (!HTENTRY_CLEAR_P (probe)) |
1376 probe->value = make_int (XINT (probe->value) + offset); | 1376 probe->value = make_fixnum (XFIXNUM (probe->value) + offset); |
1377 else | 1377 else |
1378 { | 1378 { |
1379 probe->key = key; | 1379 probe->key = key; |
1380 probe->value = make_int (offset); | 1380 probe->value = make_fixnum (offset); |
1381 | 1381 |
1382 if (++ht->count >= ht->rehash_count) | 1382 if (++ht->count >= ht->rehash_count) |
1383 { | 1383 { |
1384 enlarge_hash_table (ht); | 1384 enlarge_hash_table (ht); |
1385 return NULL; | 1385 return NULL; |
1488 DEFUN ("hash-table-count", Fhash_table_count, 1, 1, 0, /* | 1488 DEFUN ("hash-table-count", Fhash_table_count, 1, 1, 0, /* |
1489 Return the number of entries in HASH-TABLE. | 1489 Return the number of entries in HASH-TABLE. |
1490 */ | 1490 */ |
1491 (hash_table)) | 1491 (hash_table)) |
1492 { | 1492 { |
1493 return make_int (xhash_table (hash_table)->count); | 1493 return make_fixnum (xhash_table (hash_table)->count); |
1494 } | 1494 } |
1495 | 1495 |
1496 DEFUN ("hash-table-test", Fhash_table_test, 1, 1, 0, /* | 1496 DEFUN ("hash-table-test", Fhash_table_test, 1, 1, 0, /* |
1497 Return HASH-TABLE's test. | 1497 Return HASH-TABLE's test. |
1498 | 1498 |
1509 Return the size of HASH-TABLE. | 1509 Return the size of HASH-TABLE. |
1510 This is the current number of slots in HASH-TABLE, whether occupied or not. | 1510 This is the current number of slots in HASH-TABLE, whether occupied or not. |
1511 */ | 1511 */ |
1512 (hash_table)) | 1512 (hash_table)) |
1513 { | 1513 { |
1514 return make_int (xhash_table (hash_table)->size); | 1514 return make_fixnum (xhash_table (hash_table)->size); |
1515 } | 1515 } |
1516 | 1516 |
1517 DEFUN ("hash-table-rehash-size", Fhash_table_rehash_size, 1, 1, 0, /* | 1517 DEFUN ("hash-table-rehash-size", Fhash_table_rehash_size, 1, 1, 0, /* |
1518 Return the current rehash size of HASH-TABLE. | 1518 Return the current rehash size of HASH-TABLE. |
1519 This is a float greater than 1.0; the factor by which HASH-TABLE | 1519 This is a float greater than 1.0; the factor by which HASH-TABLE |
2083 /* Characters and numbers of the same numeric value hash | 2083 /* Characters and numbers of the same numeric value hash |
2084 differently, which is fine, they're not equalp. */ | 2084 differently, which is fine, they're not equalp. */ |
2085 return LISP_HASH (make_char (CANONCASE (NULL, XCHAR (obj)))); | 2085 return LISP_HASH (make_char (CANONCASE (NULL, XCHAR (obj)))); |
2086 } | 2086 } |
2087 | 2087 |
2088 if (INTP (obj)) | 2088 if (FIXNUMP (obj)) |
2089 { | 2089 { |
2090 return FLOAT_HASHCODE_FROM_DOUBLE ((double) (XINT (obj))); | 2090 return FLOAT_HASHCODE_FROM_DOUBLE ((double) (XFIXNUM (obj))); |
2091 } | 2091 } |
2092 } | 2092 } |
2093 | 2093 |
2094 return LISP_HASH (obj); | 2094 return LISP_HASH (obj); |
2095 } | 2095 } |
2204 } | 2204 } |
2205 | 2205 |
2206 min = Ffunction_min_args (equal_function); | 2206 min = Ffunction_min_args (equal_function); |
2207 max = Ffunction_max_args (equal_function); | 2207 max = Ffunction_max_args (equal_function); |
2208 | 2208 |
2209 if (!((XINT (min) <= 2) && (NILP (max) || 2 <= XINT (max)))) | 2209 if (!((XFIXNUM (min) <= 2) && (NILP (max) || 2 <= XFIXNUM (max)))) |
2210 { | 2210 { |
2211 signal_wrong_number_of_arguments_error (equal_function, 2); | 2211 signal_wrong_number_of_arguments_error (equal_function, 2); |
2212 } | 2212 } |
2213 | 2213 |
2214 min = Ffunction_min_args (hash_function); | 2214 min = Ffunction_min_args (hash_function); |
2215 max = Ffunction_max_args (hash_function); | 2215 max = Ffunction_max_args (hash_function); |
2216 | 2216 |
2217 if (!((XINT (min) <= 1) && (NILP (max) || 1 <= XINT (max)))) | 2217 if (!((XFIXNUM (min) <= 1) && (NILP (max) || 1 <= XFIXNUM (max)))) |
2218 { | 2218 { |
2219 signal_wrong_number_of_arguments_error (hash_function, 1); | 2219 signal_wrong_number_of_arguments_error (hash_function, 1); |
2220 } | 2220 } |
2221 | 2221 |
2222 define_hash_table_test (name, lisp_object_general_equal, | 2222 define_hash_table_test (name, lisp_object_general_equal, |
2401 data haven't been garbage collected. */ | 2401 data haven't been garbage collected. */ |
2402 assert (!NILP (Fassq (Qeq, weak_list_list))); | 2402 assert (!NILP (Fassq (Qeq, weak_list_list))); |
2403 assert (!NILP (Fassq (Qeql, weak_list_list))); | 2403 assert (!NILP (Fassq (Qeql, weak_list_list))); |
2404 assert (!NILP (Fassq (Qequal, weak_list_list))); | 2404 assert (!NILP (Fassq (Qequal, weak_list_list))); |
2405 assert (!NILP (Fassq (Qequalp, weak_list_list))); | 2405 assert (!NILP (Fassq (Qequalp, weak_list_list))); |
2406 assert (4 == XINT (Flength (weak_list_list))); | 2406 assert (4 == XFIXNUM (Flength (weak_list_list))); |
2407 | 2407 |
2408 Vhash_table_test_weak_list = make_weak_list (WEAK_LIST_KEY_ASSOC); | 2408 Vhash_table_test_weak_list = make_weak_list (WEAK_LIST_KEY_ASSOC); |
2409 XWEAK_LIST_LIST (Vhash_table_test_weak_list) = weak_list_list; | 2409 XWEAK_LIST_LIST (Vhash_table_test_weak_list) = weak_list_list; |
2410 | 2410 |
2411 #ifdef MEMORY_USAGE_STATS | 2411 #ifdef MEMORY_USAGE_STATS |