Rewrite inner loop. should be a little bit faster.
This commit is contained in:
1 parent
a5ac43e5f3
commit
4b1ed25ef3
1 file changed
+5
-4
+5
-4
@@ -403,10 +403,11 @@
|
|||||||
assert (num <= N); \
|
assert (num <= N); \
|
||||||
for(i = 0; i < num; i++) { \
|
for(i = 0; i < num; i++) { \
|
||||||
int cmp = M_GET_CMP key_oplist (key, n->key[i]); \
|
int cmp = M_GET_CMP key_oplist (key, n->key[i]); \
|
||||||
if (M_UNLIKELY (cmp == 0)) { \
|
if (cmp <= 0) { \
|
||||||
M_IF(isMap)(M_GET_SET value_oplist (n->kind.value[i], value);,) \
|
if (M_UNLIKELY (cmp == 0)) { \
|
||||||
return -1; \
|
M_IF(isMap)(M_GET_SET value_oplist (n->kind.value[i], value);,) \
|
||||||
} else if (cmp < 0) { \
|
return -1; \
|
||||||
|
} \
|
||||||
/* Move tables to make space for insertion */ \
|
/* Move tables to make space for insertion */ \
|
||||||
memmove(&n->key[i+1], &n->key[i], sizeof(key_t)*(num-i)); \
|
memmove(&n->key[i+1], &n->key[i], sizeof(key_t)*(num-i)); \
|
||||||
M_IF(isMap)(memmove(&n->kind.value[i+1], &n->kind.value[i], sizeof(value_t)*(num-i));,) \
|
M_IF(isMap)(memmove(&n->kind.value[i+1], &n->kind.value[i], sizeof(value_t)*(num-i));,) \
|
||||||
|
|||||||
Reference in new issue
Block a user