fix: Allow n() function to count (empty) cells off edge of sheet (#84)

Resolves #83.

Co-authored-by: Glen Whitney <glen@studioinfinity.org>
Reviewed-on: #84
This commit is contained in:
Glen Whitney 2023-04-09 19:28:57 +00:00
parent d38cf2b913
commit 34e8b99585
3 changed files with 17 additions and 6 deletions

View file

@ -30,16 +30,15 @@
#include "utf8.h"
/*}}}*/
/* posorder -- sort two integers */ /*{{{*/
/* posorder -- sort two integers, clamping each to be nonnegative. */ /*{{{*/
void posorder(int *x, int *y)
{
assert(x != (int*)0);
assert(*x >= 0);
assert(y != (int*)0);
assert(*y >= 0);
if (*x < 0) *x = 0;
if (*y < 0) *y = 0;
if (*x > *y)
{
if (*x > *y) {
int t = *x;
*x = *y;
*y = t;