summaryrefslogtreecommitdiffstats
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
commitb5d9efa581f8462af10b997c691ae2f78c1022d3 (patch)
tree9b38bb804037fd8edbc17a3a4f1f58cbc4b8105f
parentda213564ff75742e0081e4c2f21e6b51c736d3cf (diff)
downloadtxr-b5d9efa581f8462af10b997c691ae2f78c1022d3.tar.gz
txr-b5d9efa581f8462af10b997c691ae2f78c1022d3.tar.bz2
txr-b5d9efa581f8462af10b997c691ae2f78c1022d3.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.
-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"));
}