uint8_t nr_child;
uint8_t *values;
struct cds_ja_inode_flag **pointers;
- struct cds_ja_inode_flag *ptr = NULL;
+ struct cds_ja_inode_flag *ptr, *match_ptr = NULL;
unsigned int i;
- int match_idx = -1, match_v;
+ int match_v;
assert(type->type_class == RCU_JA_LINEAR || type->type_class == RCU_JA_POOL);
assert(dir == JA_LEFT || dir == JA_RIGHT);
if (dir == JA_LEFT) {
if ((int) v < n && (int) v > match_v) {
match_v = v;
- match_idx = i;
+ match_ptr = ptr;
}
} else {
if ((int) v > n && (int) v < match_v) {
match_v = v;
- match_idx = i;
+ match_ptr = ptr;
}
}
}
- if (match_idx < 0) {
+ if (!match_ptr) {
return NULL;
}
assert(match_v >= 0 && match_v < JA_ENTRY_PER_NODE);
*result_key = (uint8_t) match_v;
- ptr = rcu_dereference(pointers[match_idx]);
- return ptr;
+ return match_ptr;
}
static
unsigned int tree_depth, i;
struct cds_ja_inode_flag *node_flag;
- if (caa_unlikely(key > ja->key_max))
+ if (caa_unlikely(key > ja->key_max || key == UINT64_MAX))
return NULL;
tree_depth = ja->tree_depth;
node_flag = rcu_dereference(ja->root);
switch (mode) {
case JA_LOOKUP_BE:
- if (caa_unlikely(key > ja->key_max))
- return NULL;
- break;
case JA_LOOKUP_AE:
- if (caa_unlikely(key > ja->key_max))
+ if (caa_unlikely(key > ja->key_max || key == UINT64_MAX))
return NULL;
break;
default:
**node_flag_ptr;
int ret;
- if (caa_unlikely(key > ja->key_max)) {
+ if (caa_unlikely(key > ja->key_max || key == UINT64_MAX)) {
return -EINVAL;
}
tree_depth = ja->tree_depth;
int nr_snapshot;
int ret;
- if (caa_unlikely(key > ja->key_max))
+ if (caa_unlikely(key > ja->key_max || key == UINT64_MAX))
return -EINVAL;
tree_depth = ja->tree_depth;