From 7a8674671096265d5cd46702719c594eba61fb69 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Wed, 7 Nov 2012 21:42:18 +0000 Subject: [PATCH] analyze: use simpler comparison In some cases the this can make run time to take 2.5% less time. Signed-off-by: Sami Kerola --- src/analyze.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/analyze.c b/src/analyze.c index d8781fd..e3e709e 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -66,11 +66,13 @@ int do_counting(void) unsigned long i, k, block_size; range_p = ranges; + unsigned long r_end; /* Walk through ranges */ for (i = 0; i < num_ranges; i++) { /* Count IPs in use */ - for (l = leases; l != NULL && range_p->last_ip >= l->ip; l = l->hh.next) { + r_end = range_p->last_ip + 1; + for (l = leases; l != NULL && l->ip < r_end; l = l->hh.next) { if (l->ip < range_p->first_ip) { /* should not be necessary */ continue;