merge from 1.8
[bpt/guile.git] / srfi / srfi-60.c
index 8d330cb..f631c64 100644 (file)
@@ -1,6 +1,6 @@
 /* srfi-60.c --- Integers as Bits
  *
- * Copyright (C) 2005 Free Software Foundation, Inc.
+ * Copyright (C) 2005, 2006 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <libguile.h>
@@ -36,7 +36,7 @@ SCM_DEFINE (scm_srfi60_log2_binary_factors, "log2-binary-factors", 1, 0, 0,
 {
   SCM ret = SCM_EOL;
 
-  if (SCM_INUMP (n))
+  if (SCM_I_INUMP (n))
     {
       long nn = SCM_I_INUM (n);
       if (nn == 0)
@@ -77,16 +77,16 @@ SCM_DEFINE (scm_srfi60_copy_bit, "copy-bit", 3, 0, 0,
   ii = scm_to_ulong (index);
   bb = scm_to_bool (bit);
 
-  if (SCM_INUMP (n))
+  if (SCM_I_INUMP (n))
     {
-      long nn = SCM_INUM (n);
+      long nn = SCM_I_INUM (n);
 
       /* can't set high bit ii==SCM_LONG_BIT-1, that would change the sign,
          which is not what's wanted */
       if (ii < SCM_LONG_BIT-1)
         {
           nn &= ~(1L << ii);  /* zap bit at index */
-          nn |= (bb << ii);   /* insert desired bit */
+          nn |= ((long) bb << ii);   /* insert desired bit */
           return scm_from_long (nn);
         }
       else
@@ -146,9 +146,9 @@ SCM_DEFINE (scm_srfi60_rotate_bit_field, "rotate-bit-field", 4, 0, 0,
 
   cc = scm_to_ulong (scm_modulo (count, scm_difference (end, start)));
 
-  if (SCM_INUMP (n))
+  if (SCM_I_INUMP (n))
     {
-      long nn = SCM_INUM (n);
+      long nn = SCM_I_INUM (n);
 
       if (ee <= SCM_LONG_BIT-1)
         {
@@ -234,9 +234,9 @@ SCM_DEFINE (scm_srfi60_reverse_bit_field, "reverse-bit-field", 3, 0, 0,
   long swaps = (ee - ss) / 2;  /* number of swaps */
   SCM b;
 
-  if (SCM_INUMP (n))
+  if (SCM_I_INUMP (n))
     {
-      long nn = SCM_INUM (n);
+      long nn = SCM_I_INUM (n);
 
       if (ee <= SCM_LONG_BIT-1)
         {
@@ -327,7 +327,7 @@ SCM_DEFINE (scm_srfi60_integer_to_list, "integer->list", 1, 1, 0,
     len = scm_integer_length (n);
   ll = scm_to_ulong (len);
 
-  if (SCM_INUMP (n))
+  if (SCM_I_INUMP (n))
     {
       long nn = SCM_I_INUM (n);
       for (i = 0; i < ll; i++)
@@ -403,8 +403,9 @@ SCM_DEFINE (scm_srfi60_list_to_integer, "list->integer", 1, 0, 0,
 #undef FUNC_NAME
 
 
-SCM_REGISTER_PROC (s_srfi60_booleans_to_integer, "booleans->integer", 0, 0, 1,
-                   scm_srfi60_list_to_integer);
+/* note: don't put "scm_srfi60_list_to_integer" arg on its own line, a
+   newline breaks the snarfer */
+SCM_REGISTER_PROC (s_srfi60_booleans_to_integer, "booleans->integer", 0, 0, 1, scm_srfi60_list_to_integer);
 
 
 void