字典
来源:互联网 发布:知乎 精华回答 标准 编辑:程序博客网 时间:2024/04/30 00:15
// Dict.h
// 哈希表节点结构:每个dictEntry结构都保存着一个键值对:
typedef struct dictEntry {
void *key;
union {
void *val;
uint64_t u64;
int64_t s64;
double d;
} v;
struct dictEntry *next;
} dictEntry;
typedef struct dictType {
unsigned int (*hashFunction)(const void *key);
void *(*keyDup)(void *privdata, const void *key);
void *(*valDup)(void *privdata, const void *obj);
int (*keyCompare)(void *privdata, const void *key1, const void *key2);
void (*keyDestructor)(void *privdata, void *key);
void (*valDestructor)(void *privdata, void *obj);
} dictType;
/* This is our hash table structure. Every dictionary has two of this as we
* implement incremental rehashing, for the old to the new table. */
typedef struct dictht {
dictEntry **table;
unsigned long size;
unsigned long sizemask;
unsigned long used;
} dictht;
typedef struct dict {
dictType *type;
void *privdata;
dictht ht[2];
long rehashidx; /* rehashing not in progress if rehashidx == -1 */
int iterators; /* number of iterators currently running */
} dict;
/* If safe is set to 1 this is a safe iterator, that means, you can call
* dictAdd, dictFind, and other functions against the dictionary even while
* iterating. Otherwise it is a non safe iterator, and only dictNext()
* should be called while iterating. */
typedef struct dictIterator {
dict *d;
long index;
int table, safe;
dictEntry *entry, *nextEntry;
/* unsafe iterator fingerprint for misuse detection. */
long long fingerprint;
} dictIterator;
- 字典
- 字典
- 字典
- 字典
- 字典
- 字典
- 字典
- 字典
- 字典
- 字典
- 字典
- 字典
- 字典
- 字典
- 字典
- 字典
- 字典
- 字典
- 【总结】iOS开发申请真机测试设备的一些理由
- android 自定义progressDialog实现
- 技术文章网址4
- 删除.svn隐藏文件
- POJ - 1733 Parity game 带权并查集+离散化
- 字典
- .net笔记
- 第三讲ThinkPHP 3.1.2 输出和模型使用
- POJ 2778 DNA Sequence [AC自动机 + 矩阵快速幂]
- Tomcat服务器的相关内容
- Android开发:性能最佳实践-管理应用内存
- 【php】“__toString()”方法使用
- 闪回归档(11G新功能)远离ORA-01555错误
- 剑侠3d任务系统开发笔记(二)之任务流程的确定