bug-mes
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] mes: Make logand work correctly


From: W. J. van der Laan
Subject: [PATCH] mes: Make logand work correctly
Date: Tue, 20 Apr 2021 13:24:27 +0000

* src/math.c (logand): Start from -1 instead of 0, so that the bitwise AND-ed
  result is the intersection of bit sets instead of always 0.
---
 src/math.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

This matches guile's results.

diff --git a/src/math.c b/src/math.c
index 
390707f8c2084c338cbf5650307a4f4e0b0d2f21..669635178c4a199925aecb479c54d2c5262ef96f
 100644
--- a/src/math.c
+++ b/src/math.c
@@ -177,7 +177,7 @@ multiply (SCM x)                ///((name . "*") (arity . 
n))
 SCM
 logand (SCM x)                  ///((arity . n))
 {
-  long n = 0;
+  long n = -1;
   while (x != cell_nil)
     {
       assert_number ("multiply", CAR (x));
--
2.27.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]