From de297b76dbd853cd1ab91b09eaa7b8e5b81c43ff Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 20 Jun 2024 02:03:36 -0700 Subject: 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. --- combi.c | 12 ++++++------ 1 file 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")); } -- cgit v1.2.3