From 224a1eebfbfd5edc4ce29121fb0a1a9260ec45db Mon Sep 17 00:00:00 2001 From: Chen Puqing Date: Tue, 18 Feb 2014 23:18:29 +0800 Subject: [PATCH] optimize the search of empty slot in the hashid_node array --- service-src/hashid.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service-src/hashid.h b/service-src/hashid.h index dc410eb2..1d567122 100644 --- a/service-src/hashid.h +++ b/service-src/hashid.h @@ -90,7 +90,7 @@ hashid_insert(struct hashid * hi, int id) { struct hashid_node *c = NULL; int i; for (i=0;icap;i++) { - int index = (i+hi->count) % hi->cap; + int index = (i+id) % hi->cap; if (hi->id[index].id == -1) { c = &hi->id[index]; break;