/* 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
*
* 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>
{
SCM ret = SCM_EOL;
- if (SCM_INUMP (n))
+ if (SCM_I_INUMP (n))
{
long nn = SCM_I_INUM (n);
if (nn == 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
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)
{
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)
{
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++)
#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