-
Notifications
You must be signed in to change notification settings - Fork 0
/
intset.h
61 lines (48 loc) · 1.22 KB
/
intset.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
59
/*
* intset.h
*
* 正の整数の集合
*
*
*/
#ifndef INTSET_H
#define INTSET_H
#ifndef DEFAULTS_H
# include "defaults.h"
#endif
typedef unsigned char bits8;
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif
#ifndef NULL
#define NULL 0
#endif
/*
* 256bits that means this set can only
* have integers 0 to 255. 255 states only.
*/
#define BITSBYTES (MAX_BITS/8)
typedef struct {
short capacity;
short maximum; /* number of items */
short curr; /* working variable for iteration */
unsigned char bits[BITSBYTES];
} _Intset, *Intsetp ;
Intsetp NewIntset (unsigned int capacity);
Intsetp NewIntsetAt (unsigned int capacity, Intsetp is);
void ISreset (Intsetp);
void ISrelease (Intsetp);
void ISaddItem (Intsetp, unsigned);
void ISaddAllItems (Intsetp, Intsetp);
void ISremoveItems (Intsetp, unsigned);
int ISisInSet (Intsetp, unsigned);
void ISiterate (Intsetp);
int ISnext (Intsetp);
int ISnextNot (Intsetp);
void ISiterateRev (Intsetp);
int ISnextNotRev (Intsetp);
int ISisEqual (Intsetp, Intsetp);
Intsetp ISclone (Intsetp src, Intsetp dest);
int ISisEmpty (Intsetp set);
#endif