-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathiixsc.h
58 lines (41 loc) · 1.38 KB
/
iixsc.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* comment me!
*/
#ifndef _EMERALD_IIXSC_H
#define _EMERALD_IIXSC_H
#include "iisc.h"
#define IIXScNIL IIScNIL
#define IIXScIsNIL(x) IIScIsNIL(x)
#define SMALLONES (2 * 1024 + 3)
struct IIXScElement {
int size, value;
};
typedef struct IIXScRecord {
union { int i; struct IIXScElement *p; } smallOnes[SMALLONES];
IISc bigOnes;
int compacted;
int count, bigstart;
struct IIXScElement *pairs;
} IIXScRecord, *IIXSc;
/* OPERATIONS */
/* Return a new, empty Searchable Collection */
IIXSc IIXScCreate(void);
/* Destroy a collection */
void IIXScDestroy(IIXSc);
/* Insert the pair <key, value> into collection IIXSc */
void IIXScInsert(IIXSc sc, int key, int value);
/* bump the value associated with some given key in the IIXSc */
int IIXScBump(IIXSc sc, int key);
/* bump the value associated with some given key in the IIXSc by value */
int IIXScBumpBy(IIXSc sc, int key, int value);
/* Prepare for calling SelectSmaller */
void IIXScCompact(IIXSc sc);
/* Select the largest key in the set that is no larger than key */
int IIXScSelectSmaller(IIXSc sc, int key);
/* Return the value associated with key in collection
* IIXSc, or 0 if no such pair exists */
int IIXScLookup(IIXSc sc, int key);
/* DEBUGGING: Print the collection IIXSc */
void IIXScPrint(IIXSc sc);
void IIXScMap(IIXSc sc, void (*f)(int, int, void *), void *a);
#include "storage.h"
#endif /* _EMERALD_IIXSC_H */