/* srfi-60.c --- Integers as Bits
*
- * Copyright (C) 2005 Free Software Foundation, Inc.
+ * Copyright (C) 2005, 2006, 2008 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
*
* 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
*/
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
#include <libguile.h>
-#include "libguile/private-gc.h" /* for SCM_MIN */
-#include "srfi-60.h"
+#include <srfi/srfi-60.h>
SCM_DEFINE (scm_srfi60_log2_binary_factors, "log2-binary-factors", 1, 0, 0,
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
long nn = SCM_I_INUM (n);
for (i = 0; i < ll; i++)
{
- unsigned long shift = SCM_MIN (i, (unsigned long) SCM_LONG_BIT-1);
+ unsigned long shift =
+ (i < ((unsigned long) SCM_LONG_BIT-1))
+ ? i : ((unsigned long) SCM_LONG_BIT-1);
int bit = (nn >> shift) & 1;
ret = scm_cons (scm_from_bool (bit), ret);
}
#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