summaryrefslogtreecommitdiffstats
path: root/combi.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2024-06-20 02:03:36 -0700
committerKaz Kylheku <kaz@kylheku.com>2024-06-20 02:03:36 -0700
commitde297b76dbd853cd1ab91b09eaa7b8e5b81c43ff (patch)
tree9b38bb804037fd8edbc17a3a4f1f58cbc4b8105f /combi.c
parentc3c1490109c3600e2e8e63f24ebe3021b23b96dc (diff)
downloadtxr-de297b76dbd853cd1ab91b09eaa7b8e5b81c43ff.tar.gz
txr-de297b76dbd853cd1ab91b09eaa7b8e5b81c43ff.tar.bz2
txr-de297b76dbd853cd1ab91b09eaa7b8e5b81c43ff.zip
combi: replace some zerop tests.
* combi.c (rperm, comb_init): Replace zerop(k) tests with k == zero which is more specific and faster, testing only for the integer zero that we care about.
Diffstat (limited to 'combi.c')
-rw-r--r--combi.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/combi.c b/combi.c
index 2b55ee08..0005b181 100644
--- a/combi.c
+++ b/combi.c
@@ -452,26 +452,26 @@ val rperm(val seq, val k)
switch (type(seq)) {
case NIL:
- if (zerop(k))
+ if (k == zero)
return cons(nil, nil);
return nil;
case CONS:
case LCONS:
- if (zerop(k))
+ if (k == zero)
return cons(nil, nil);
return rperm_list(seq, k);
case VEC:
- if (zerop(k))
+ if (k == zero)
return cons(vector(zero, nil), nil);
return rperm_vec(seq, k);
case STR:
case LSTR:
case LIT:
- if (zerop(k))
+ if (k == zero)
return cons(string(L""), nil);
return rperm_str(seq, k);
default:
- if (zerop(k))
+ if (k == zero)
return cons(make_like(nil, seq), nil);
return rperm_seq(seq, k);
}
@@ -574,7 +574,7 @@ static val k_conses(val list, val k, val self)
static val comb_init(val list, val k)
{
- if (zerop(k))
+ if (k == zero)
return nil;
return k_conses(list, k, lit("comb"));
}