This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Should logior (and friends) operate only on inums?
- To: Janis Dzerins <jonis at mt dot lv>
- Subject: Re: Should logior (and friends) operate only on inums?
- From: "Greg J. Badros" <gjb at cs dot washington dot edu>
- Date: 17 Jan 2000 10:00:42 -0800
- Cc: guile at sourceware dot cygnus dot com
- References: <Pine.LNX.4.10.10001171647520.741-100000@goo.dev.mt.lv>
Janis Dzerins <jonis@mt.lv> writes:
> Or should they be more general? (At the moment I need logXXX to act on
> longs with the mask like #xf0000000, but, only INMUS accepted)
I asked the same question a little while ago on the devel-guile list but
I don't think anyone responded. I was concerned more about whether
inexact numbers should be converted and usable; I'd changed the
operations you're talking about to use INUMs, not considering the
non-immediate integers.
We need to figure out which of the routines in numbers.c should be used
for which functions. I think there should probably be:
SCM_VALIDATE_LONG_COPY
and
SCM_VALIDATE_ULONG_COPY
macros that then call appropriate functions from numbers.c to convert
and verify argument type. In the interim, you can change the lines like:
SCM_VALIDATE_INUM_COPY (1,n1,i1);
to
i1 = SCM_NUM2ULONG(1,n1);
in numbers.c. Again, the issue is that SCM_NUM2ULONG allows inexact
numbers as its argument (but does throw an outofrange if the number
isn't equal to a long). Is this a problem?
Greg