-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathxpower-hash.h
45 lines (35 loc) · 862 Bytes
/
xpower-hash.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
** Copyright (C) 2011 XXX all rights reserved.
**
** This file defines Dispatcher Training Simulator (DTS)
** hash and only used for internal.
**
** Created by chuck-liu@qq.com on 01/11/2011
**
*/
#ifndef _XPOWER_HASH_H_
#define _XPOWER_HASH_H_
#include "xpower-config.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _xhash_entry {
unsigned int hash;
unsigned int index;
};
struct _xhash {
unsigned int size,next;
struct _xhash_entry *bucket;
};
extern int _xlookup_hash(unsigned int hash, const struct _xhash *table);
extern int _xinsert_hash(unsigned int hash, unsigned int index, struct _xhash *table);
extern void _xfree_hash(struct _xhash *table);
static inline void _xinit_hash(struct _xhash *table){
table->size = 0;
table->next = 0;
table->bucket = NULL;
}
#ifdef __cplusplus
}
#endif
#endif/*_XPOWER_HASH_H_*/