mes.c: add logior.

This commit is contained in:
Jan Nieuwenhuizen 2016-07-24 17:21:30 +02:00
parent bbdba26201
commit 2983578531
2 changed files with 14 additions and 0 deletions

13
mes.c
View file

@ -1189,6 +1189,19 @@ multiply (scm *x/*...*/)
return make_number (n);
}
scm *
logior (scm *x/*...*/)
{
int n = 0;
while (x != &scm_nil)
{
assert (x->car->type == NUMBER);
n |= x->car->value;
x = cdr (x);
}
return make_number (n);
}
scm *add_environment (scm *a, char *name, scm *x);
scm *

View file

@ -105,6 +105,7 @@
(pass-if "remainder" (seq? (remainder 11 3) 2))
(pass-if "modulo" (seq? (modulo 11 3) 2))
(pass-if "expt" (seq? (expt 2 3) 8))
(pass-if "logior" (seq? (logior 0 1 2 4) 7))
(pass-if "=" (seq? 3 '3))
(pass-if "= 2" (not (= 3 '4)))