core: Add logand, lognot.
* src/math.c (logand, lognot): New function.
This commit is contained in:
parent
989bfdbd25
commit
4175579d08
21
src/math.c
21
src/math.c
|
@ -135,6 +135,19 @@ multiply (SCM x) ///((name . "*") (arity . n))
|
|||
return MAKE_NUMBER (n);
|
||||
}
|
||||
|
||||
SCM
|
||||
logand (SCM x) ///((arity . n))
|
||||
{
|
||||
int n = 0;
|
||||
while (x != cell_nil)
|
||||
{
|
||||
assert (TYPE (car (x)) == TNUMBER);
|
||||
n &= VALUE (car (x));
|
||||
x = cdr (x);
|
||||
}
|
||||
return MAKE_NUMBER (n);
|
||||
}
|
||||
|
||||
SCM
|
||||
logior (SCM x) ///((arity . n))
|
||||
{
|
||||
|
@ -148,6 +161,14 @@ logior (SCM x) ///((arity . n))
|
|||
return MAKE_NUMBER (n);
|
||||
}
|
||||
|
||||
SCM
|
||||
lognot (SCM x)
|
||||
{
|
||||
assert (TYPE (x) == TNUMBER);
|
||||
int n = ~VALUE (x);
|
||||
return MAKE_NUMBER (n);
|
||||
}
|
||||
|
||||
SCM
|
||||
ash (SCM n, SCM count)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue