diff src/dired.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 ff13c44ce0d9
children 427a72c6ee17
line wrap: on
line diff
--- a/src/dired.c	Wed Apr 24 20:16:14 2013 -0400
+++ b/src/dired.c	Mon Jun 17 10:23:00 2013 -0600
@@ -915,8 +915,8 @@
     }
 
 #ifndef HAVE_BIGNUM
-  size = make_integer (NUMBER_FITS_IN_A_FIXNUM (s.st_size) ?
-		       (EMACS_INT)s.st_size : -1);
+  size = make_fixnum (NUMBER_FITS_IN_A_FIXNUM (s.st_size) ?
+		      (EMACS_INT)s.st_size : -1);
 #else
   size = make_integer (s.st_size);
 #endif
@@ -939,8 +939,8 @@
 
   if (NILP(id_format) || EQ (id_format, Qinteger))
     {
-      uidInfo = make_integer (s.st_uid);
-      gidInfo = make_integer (s.st_gid);
+      uidInfo = make_unsigned_integer (s.st_uid);
+      gidInfo = make_unsigned_integer (s.st_gid);
     }
   else
     {
@@ -957,7 +957,7 @@
   
   RETURN_UNGCPRO (listn (12,
 			 mode,
-			 make_integer (s.st_nlink),
+			 make_unsigned_integer (s.st_nlink),
 			 uidInfo,
 			 gidInfo,
 			 make_time (s.st_atime),
@@ -966,8 +966,8 @@
 			 size,
 			 modestring,
 			 gid,
-			 make_integer (s.st_ino),
-			 make_integer (s.st_dev)));
+			 make_unsigned_integer (s.st_ino),
+			 make_unsigned_integer (s.st_dev)));
 }