コード例 #1
0
ファイル: mapdb.c プロジェクト: ksandstr/mung
static uint32_t ref_next(
	uint32_t *aux_p,
	struct ref_iter *it, struct map_group *g)
{
	if(it->b_cs != NULL) {
bucketmode:
		if(++it->bpos < it->blim) {
			*aux_p = it->b_aux[it->bpos];
			return it->b_cs[it->bpos];
		} else {
			/* exit the bucket. */
			it->b_cs = NULL;
			it->b_aux = NULL;
		}
	}

	while(it->pos + 1 < it->lim) {
		int slot = ++it->pos & it->mask;
		uint32_t c = g->children[slot];
		int aux = g->c_aux[slot];
		if(IS_REF(c) && AUX_INDEX(aux) == it->ix) {
			*aux_p = aux;
			return c;
		}
		if(c == 0) break;
		if(IS_BUCKET(c)) {
			ref_enter_bucket(it, g, c);
			assert(it->b_cs != NULL);
			goto bucketmode;
		}
		assert(c == REF_TOMBSTONE
			|| (IS_REF(c) && AUX_INDEX(aux) != it->ix));
	}
	return 0;
}
コード例 #2
0
ファイル: mapdb.c プロジェクト: ksandstr/mung
/* NOTE: @it only becomes valid if the return value is not 0. */
static uint32_t ref_first(
	uint32_t *aux_p,
	struct ref_iter *it, struct map_group *g, int ix)
{
	if(MG_N_ALLOC_LOG2(g) == 0) return 0;

	it->ix = ix;
	it->mask = (1 << MG_N_ALLOC_LOG2(g)) - 1;
	it->pos = int_hash(ix) & it->mask;
	it->lim = it->pos + min(1 << MG_N_ALLOC_LOG2(g), MAX_PROBE_DEPTH);

	uint32_t c = g->children[it->pos];
	if(IS_BUCKET(c)) ref_enter_bucket(it, g, c);
	else {
		it->b_cs = NULL;
		it->b_aux = NULL;
		if(IS_REF(c) && AUX_INDEX(*aux_p = g->c_aux[it->pos]) == ix) return c;
	}
	return ref_next(aux_p, it, g);
}
コード例 #3
0
ファイル: py_hostenv.cpp プロジェクト: baztian/jpype
bool PythonHostEnvironment::isMethod(HostRef* ref)
{
	return IS_REF(ref, "JPMethod");
}