simon-git: puzzles (main): Ben Harris
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Thu Jun 22 23:10:31 BST 2023
TL;DR:
6db5cda Blackbox: correct FROMDRAW() macro for C division semantics
Repository: https://git.tartarus.org/simon/puzzles.git
On the web: https://git.tartarus.org/?p=simon/puzzles.git
Branch updated: main
Committer: Ben Harris <bjh21 at bjh21.me.uk>
Date: 2023-06-22 23:10:31
commit 6db5cdadd09fad0c8373e32dcfc7ab5b8bcb74e6
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=6db5cdadd09fad0c8373e32dcfc7ab5b8bcb74e6;hp=da014d23dad4bcff0215d9ba7758652c85c06a20
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Thu Jun 22 23:08:19 2023 +0100
Blackbox: correct FROMDRAW() macro for C division semantics
Integer division in C rounds towards zero, so if you want it to
consistently round down you need to ensure that the arguments are
positive. FROMDRAW() didn't do that, so clicks off the top and left
corners of the grid got treated as being in the top row or left column
(row and column 0) rather than ignored.
This commit fixes the macro so that it offsets its argument upward
before the division and compensates afterwards.
blackbox.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
More information about the tartarus-commits
mailing list