示例#1
0
文件: str2ptr.c 项目: discoloda/Cmod
static unsigned int _get_index(struct str2ptr *map, char *key, unsigned int hash) {
    unsigned int offset = 0, iter = map->mask ? map->mask + 1 : 0;
    while(iter--) {
        unsigned int index = (hash + offset) & map->mask;
        if(hash == map->pair[index].hash && _same(key, map->pair[index].key)) {
            return index;
        }
        ++offset;
    }
    return map->mask + 1;
}
Loc locate_elem( sq_list list, ElemType *elem ){
	for( int i = 0; i < list->length; i++ ){
		if( _same( elem, &list->elem[i])  )
			return i;
	}
}