gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gcl-devel] 2.6.5 errata page updates


From: Camm Maguire
Subject: [Gcl-devel] 2.6.5 errata page updates
Date: 29 Oct 2004 16:38:21 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings!  Just updated the 2.6.5 errata page:

1) Added the previously known patch for older gcc processing
   gmp_wrappers.h 

2) It appears that on 64bit machines, (+ most-negative-fixnum -1) is
   not calculated correctly.  This basically stems from the fact that
   (int)2^31=-(int)2^31, and one cannot cast to (unsigned long)
   carelessly.  The patch below fixes this:
=============================================================================
Index: h/mp.h
===================================================================
RCS file: /cvsroot/gcl/gcl/h/mp.h,v
retrieving revision 1.6.6.1
diff -u -r1.6.6.1 mp.h
--- h/mp.h      27 Sep 2003 16:09:48 -0000      1.6.6.1
+++ h/mp.h      29 Oct 2004 20:17:42 -0000
@@ -61,8 +61,10 @@
    action \
    
((((CMPt1=(x))+1024)&-2048)==0?small_fixnum(CMPt1):make_fixnum1(CMPt1));}while(0)
      
+#define ineg(a_) (sizeof(a_)==sizeof(unsigned) ? (unsigned)-(a_) : (unsigned 
long)-(a_))
+
 #define addii mpz_add
-#define addsi(u,a,b) (a >= 0 ?  mpz_add_ui(u,b,a) : mpz_sub_ui(u,b,-a))
+#define addsi(u,a,b) (a >= 0 ?  mpz_add_ui(u,b,a) : mpz_sub_ui(u,b,ineg(a)))
 #define addss(u,a,b) addsi(u,a,SI_TO_MP(b,big_fixnum1))
            
 #define mulii mpz_mul
@@ -71,9 +73,9 @@
            
 #define subii mpz_sub
 #define subsi(u,a,b) mpz_sub(u,SI_TO_MP(a,big_fixnum1),b)
-#define subis(u,a,b) (b >= 0 ?  mpz_sub_ui(u,a,b) : mpz_add_ui(u,a,-b))
+#define subis(u,a,b) (b >= 0 ?  mpz_sub_ui(u,a,b) : mpz_add_ui(u,a,ineg(b)))
 #define subss(u,a,b) subis(u,SI_TO_MP(a,big_fixnum1),b)
-#define shifti(u,a,w) (w>=0 ? mpz_mul_2exp(u,a,w) : 
mpz_fdiv_q_2exp(u,MP(x),-w))
+#define shifti(u,a,w) (w>=0 ? mpz_mul_2exp(u,a,w) : 
mpz_fdiv_q_2exp(u,MP(x),ineg(w)))
============================================================================= 
 
    There may be other such instances.  In general, the code needs a
    careful going over to extend wordsize independence to the integer
    arithmetic throughout.

3)  Any additions to the errata page are welcome.  Mike, don't you have
    one?  We can keep track of essential items which must go into a
    2.6.6 here in case we ever release one.  Thoughts here are most
    welcome as well.

Take care,

-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

[Prev in Thread] Current Thread [Next in Thread]