guile-cvs
[Top][All Lists]
Advanced

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

guile/guile-core/libguile num2integral.i.c


From: Marius Vollmer
Subject: guile/guile-core/libguile num2integral.i.c
Date: Sat, 06 Oct 2001 16:00:43 -0400

CVSROOT:        /cvs
Module name:    guile
Changes by:     Marius Vollmer <address@hidden> 01/10/06 16:00:43

Modified files:
        guile-core/libguile: num2integral.i.c 

Log message:
        (INTEGRAL2NUM): Let the preprocessor test
        whether the integral type fits in a fixnum, not the compiler.
        This removes a spurious compiler warning.  Also, honor the
        NO_PREPRO_MAGIC flag to suppress any preprocessor tests.  This is
        needed for `long long's.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/libguile/num2integral.i.c.diff?cvsroot=OldCVS&tr1=1.8&tr2=1.9&r1=text&r2=text

Patches:
Index: guile/guile-core/libguile/num2integral.i.c
diff -u guile/guile-core/libguile/num2integral.i.c:1.8 
guile/guile-core/libguile/num2integral.i.c:1.9
--- guile/guile-core/libguile/num2integral.i.c:1.8      Fri Oct  5 14:26:46 2001
+++ guile/guile-core/libguile/num2integral.i.c  Sat Oct  6 16:00:43 2001
@@ -79,16 +79,43 @@
 SCM
 INTEGRAL2NUM (ITYPE n)
 {
-  if (sizeof (ITYPE) < sizeof (scm_t_signed_bits)
-      ||
-#ifndef UNSIGNED  
-      SCM_FIXABLE (n)
+  /* Determine at compile time whether we need to porferm the FIXABLE
+     test or not.  This is not done to get more optimal code out of
+     the compiler (it can figure this out on its already), but to
+     avoid a spurious warning. 
+  */
+
+#ifdef NEED_CHECK
+#undef NEED_CHECK
+#endif
+
+#ifdef NO_PREPRO_MAGIC
+#define NEED_CHECK
+#else
+#ifdef UNSIGNED
+#if MAX_VALUE > SCM_MOST_POSITIVE_FIXNUM
+#define NEED_CHECK
+#endif
+#else
+#if MIN_VALUE<SCM_MOST_NEGATIVE_FIXNUM || MAX_VALUE>SCM_MOST_POSITIVE_FIXNUM
+#define NEED_CHECK
+#endif
+#endif
+#endif
+
+#ifndef UNSIGNED
+#ifdef NEED_CHECK
+  if (SCM_FIXABLE (n))
+#endif
 #else
-      SCM_POSFIXABLE (n)
-#endif 
-      )
+#ifdef NEED_CHECK
+  if (SCM_FIXABLE (n))
+#endif
+#endif
     return SCM_MAKINUM ((scm_t_signed_bits) n);
 
+#undef NEED_CHECK
+
 #ifdef SCM_BIGDIG
   return INTEGRAL2BIG (n);
 #else
@@ -152,6 +179,7 @@
 #undef ITYPE
 #undef MIN_VALUE
 #undef MAX_VALUE
+#undef NO_PREPRO_MAGIC
 
 /*
   Local Variables:



reply via email to

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