[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] mes: Make logand work correctly
From: |
Jan Nieuwenhuizen |
Subject: |
Re: [PATCH] mes: Make logand work correctly |
Date: |
Wed, 21 Apr 2021 08:36:09 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
W. J. van der Laan writes:
Thanks, good catch! Interesting how this procedure seems necessary to have, but
its result was a don't care?
Applied to master with minor nitpicks.
Subject: mes: Make logand work correctly
^period
> * 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.
^^
We follow strict ChangeLog standards and don't use indents here.
I also added a simple test
diff --git a/tests/math.test b/tests/math.test
index 157b55e57..b5fe7f146 100755
--- a/tests/math.test
+++ b/tests/math.test
@@ -41,6 +41,8 @@ exec ${MES-bin/mes} --no-auto-compile -L ${0%/*} -L module -C
module -e '(tests
(pass-if-equal "remainder" 2 (remainder 11 3))
(pass-if-equal "modulo" 2 (modulo 11 3))
(pass-if-equal "expt" 8 (expt 2 3))
+(pass-if-equal "logand" -1 (logand))
+(pass-if-equal "logand 3" 3 (logand 3 7 11))
(pass-if-equal "logior" 7 (logior 0 1 2 4))
(pass-if-equal "logxor" -2 (logxor 1 -1))
(pass-if-equal "ash"
Greetings,
Janneke
--
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | AvatarĀ® http://AvatarAcademy.com