comparison src/unicode.c @ 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 56144c8593a8
children 65d65b52d608
comparison
equal deleted inserted replaced
5735:ff13c44ce0d9 5736:3192994c49ca
1368 Lisp_Object charset; 1368 Lisp_Object charset;
1369 int ichar, unicode; 1369 int ichar, unicode;
1370 1370
1371 CHECK_CHAR (character); 1371 CHECK_CHAR (character);
1372 1372
1373 check_integer_range (code, Qzero, make_integer (MOST_POSITIVE_FIXNUM)); 1373 check_integer_range (code, Qzero, make_fixnum (MOST_POSITIVE_FIXNUM));
1374 1374
1375 unicode = XFIXNUM (code); 1375 unicode = XFIXNUM (code);
1376 ichar = XCHAR (character); 1376 ichar = XCHAR (character);
1377 charset = ichar_charset (ichar); 1377 charset = ichar_charset (ichar);
1378 1378
1444 #ifdef MULE 1444 #ifdef MULE
1445 Lisp_Object_dynarr *dyn; 1445 Lisp_Object_dynarr *dyn;
1446 int lbs[NUM_LEADING_BYTES]; 1446 int lbs[NUM_LEADING_BYTES];
1447 int c; 1447 int c;
1448 1448
1449 check_integer_range (code, Qzero, make_integer (MOST_POSITIVE_FIXNUM)); 1449 check_integer_range (code, Qzero, make_fixnum (MOST_POSITIVE_FIXNUM));
1450 c = XFIXNUM (code); 1450 c = XFIXNUM (code);
1451 { 1451 {
1452 EXTERNAL_LIST_LOOP_2 (elt, charsets) 1452 EXTERNAL_LIST_LOOP_2 (elt, charsets)
1453 Fget_charset (elt); 1453 Fget_charset (elt);
1454 } 1454 }
1470 if (ret == -1) 1470 if (ret == -1)
1471 return Qnil; 1471 return Qnil;
1472 return make_char (ret); 1472 return make_char (ret);
1473 } 1473 }
1474 #else 1474 #else
1475 check_integer_range (code, Qzero, make_integer (MOST_POSITIVE_FIXNUM)); 1475 check_integer_range (code, Qzero, make_fixnum (MOST_POSITIVE_FIXNUM));
1476 return Fint_to_char (code); 1476 return Fint_to_char (code);
1477 #endif /* MULE */ 1477 #endif /* MULE */
1478 } 1478 }
1479 1479
1480 #ifdef MULE 1480 #ifdef MULE