From fc044b9c49dd7fb377c9c79e4973ed0ae1f3a2bc Mon Sep 17 00:00:00 2001 From: Nicolas Cornu Date: Thu, 22 Feb 2024 14:54:41 +0100 Subject: [PATCH] Fix lookup in SPTree --- src/nrncvode/sptree.hpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/nrncvode/sptree.hpp b/src/nrncvode/sptree.hpp index 2af27c822a..1cc4e7e755 100644 --- a/src/nrncvode/sptree.hpp +++ b/src/nrncvode/sptree.hpp @@ -911,17 +911,15 @@ SPBLK* spenqafter(SPBLK* n, SPBLK* n1, SPTREE* q) { template SPBLK* splookup(double key, SPTREE* q) { SPBLK* n; - int Sct; int c; /* find node in the tree */ n = q->root; c = ++(q->lkpcmps); q->lookups++; - // while( n && (Sct = STRCMP( key, n->key ) ) ) - while (n && (Sct = key != n->key)) { + while (n && key != n->key) { c++; - n = (Sct < 0) ? n->leftlink : n->rightlink; + n = key < n->key ? n->leftlink : n->rightlink; } q->lkpcmps = c;