mes.c: add logior.
This commit is contained in:
parent
bbdba26201
commit
2983578531
13
mes.c
13
mes.c
|
@ -1189,6 +1189,19 @@ multiply (scm *x/*...*/)
|
||||||
return make_number (n);
|
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 *add_environment (scm *a, char *name, scm *x);
|
||||||
|
|
||||||
scm *
|
scm *
|
||||||
|
|
1
test.mes
1
test.mes
|
@ -105,6 +105,7 @@
|
||||||
(pass-if "remainder" (seq? (remainder 11 3) 2))
|
(pass-if "remainder" (seq? (remainder 11 3) 2))
|
||||||
(pass-if "modulo" (seq? (modulo 11 3) 2))
|
(pass-if "modulo" (seq? (modulo 11 3) 2))
|
||||||
(pass-if "expt" (seq? (expt 2 3) 8))
|
(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 "=" (seq? 3 '3))
|
||||||
(pass-if "= 2" (not (= 3 '4)))
|
(pass-if "= 2" (not (= 3 '4)))
|
||||||
|
|
Loading…
Reference in a new issue