This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Should logior (and friends) operate only on inums?


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]