comparison src/ChangeLog @ 5736:3192994c49ca

Convert C (un)signed long long values to bignums properly. This patch also does the following: - Uses make_fixnum instead of make_integer when the argument is guaranteed to be in the fixnum range. - Introduces make_unsigned_integer so that we handle unsigned values with the high bit set correctly. - Introduces conversions between bignums and (un)signed long long values. - Uses mp_set_memory_functions with the BSD MP code, if it exists. - Eliminates some unnecessary consing in the Lisp + and * implementations. - Fixes a problem with check_valid_xbm_inline(). This function is called during intialization. It calls Ftimes. When using pdump, this is a problem, because (a) the bignum code is not initialized until *after* dumping, so we don't try to dump any bignums, and (b) multiplication of integers is done inside bignums so we handle fixnum overflow correctly. I decided that an XBM file with dimensions that don't fit into fixnums is probably not something we want to try to handle anyway, and did the arithmetic with C values instead of Lisp values. Doing that broke one test, which started getting a different error message from the one it expected, so I adjusted the test to match the new reality. - Fixes a few miscellaneous bugs in the BSD MP code. See <CAHCOHQk0u0=eD1fUMHTNWi2Yh=1WgiYyCXdMbsGzHBNhdqYz4w@mail.gmail.com> in xemacs-patches, as well as followup messages.
author Jerry James <james@xemacs.org>
date Mon, 17 Jun 2013 10:23:00 -0600
parents ff13c44ce0d9
children a2912073be85 f9e4d44504a4
comparison
equal deleted inserted replaced
5735:ff13c44ce0d9 5736:3192994c49ca
1 2013-06-17 Jerry James <james@xemacs.org>
2
3 * alloc.c (make_bignum_un): New function.
4 (make_bignum_ll): New function.
5 (make_bignum_ull): New function.
6 * config.h.in (HAVE_MP_SET_MEMORY_FUNCTIONS): Add.
7 * data.c (Fplus): avoid unnecessary consing.
8 (Ftimes): ditto.
9 * glyphs.c (check_valid_xbm_inline): Since this function is called
10 prior to dumping, when bignums are forbidden, do all arithmetic
11 with C integers.
12 * lisp.h (MOST_POSITIVE_FIXNUM_UNSIGNED): New constant.
13 (MOST_POSITIVE_FIXNUM): Redefine in terms of the above.
14 (UNSIGNED_NUMBER_FITS_IN_A_FIXNUM): New macro.
15 * number-gmp.c (bignum_to_llong): New function.
16 (bignum_to_ullong): New function.
17 (bignum_set_llong): New function.
18 (bigfloat_to_string): Adjust whitespace.
19 (gmp_realloc): Ditto.
20 (gmp_free): Ditto.
21 * number-gmp.h (bignum_fits_llong): New macro.
22 (bignum_fits_ullong): New macro.
23 (bignum_set_ullong): New macro.
24 * number-mp.c (bignum_long_sign_bit): Remove, didn't work.
25 (bignum_min_llong): New variable.
26 (bignum_max_llong): New variable.
27 (bignum_max_ullong): New variable.
28 (bignum_to_llong): New function.
29 (bignum_to_ullong): New function.
30 (bignum_set_long): Reimplement using MP_XTOM.
31 (bignum_set_ulong): Ditto.
32 (bignum_set_llong): New function.
33 (bignum_set_ullong): New function.
34 (bignum_clrbit): Fix a comment.
35 (bignum_random_seed): Move to number-mp.h, since it is a no-op.
36 (bignum_random): Implement.
37 (mp_realloc): New function.
38 (mp_free): New function.
39 (init_number_mp): Use them. Fix a comment. Eliminate
40 initialization of bignum_long_sign_bit. Initialize
41 bignum_min_llong, bignum_max_llong, and bignum_set_ullong.
42 * number-mp.h (MP_XTOM): New macro.
43 (bignum_fits_llong_p): New macro.
44 (bignum_fits_ullong_p): New macro.
45 (bignum_random_seed): New macro.
46 * number.h: Implement bignums as long long integers.
47 (make_bignum_ll): New macro.
48 (make_integer): Accept a long long value.
49 (make_unsigned_integer): New macro.
50 (NATNUMP): Adjust whitespace.
51 (non_fixnum_number_p): Ditto.
52
53 * alloc.c (Fmake_list): Use make_unsigned_integer or make_fixnum
54 instead of make_integer where it is appropriate to do so.
55 * chartab.c (char_table_default_for_type): Ditto.
56 * dired.c (Ffile_attributes): Ditto.
57 * elhash.c (hash_table_size_validate): Ditto.
58 * eval.c (Fmacroexpand): Ditto.
59 * event-stream.c (Faccept_process_output): Ditto.
60 (Frecent_keys): Ditto.
61 * events.c (Fmake_event): Ditto.
62 (Fevent_timestamp_lessp): Ditto.
63 * font-mgr.c (Ffc_pattern_get): Ditto.
64 * indent.c (Fmove_to_column): Ditto.
65 * process.c (Fset_process_window_size): Ditto.
66 * profile.c (Fstart_profiling): Ditto.
67 * unicode.c (Fset_unicode_conversion): Ditto.
68 (Funicode_to_char): Ditto.
69
1 2013-04-23 Vin Shelton <acs@xemacs.org> 70 2013-04-23 Vin Shelton <acs@xemacs.org>
2 71
3 * sysdep.c (qxe_getgrgid): Hack in WIN32_NATIVE group support. 72 * sysdep.c (qxe_getgrgid): Hack in WIN32_NATIVE group support.
4 * dired.c (file_attributes): Add a hack for group name in native 73 * dired.c (file_attributes): Add a hack for group name in native
5 Windows builds. 74 Windows builds.