1 /*  an - Anagram generator
2     Copyright (C) 2012  Paul Martin <pm@debian.org>
3 
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8 
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13 
14     You should have received a copy of the GNU General Public License along
15     with this program; if not, write to the Free Software Foundation, Inc.,
16     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18 
19 
20 #ifndef BITFIELD_H
21 #define BITFIELD_H
22 
23 #include <unicode/uchar.h>
24 #include <stdint.h>
25 #include <stdbool.h>
26 
27 #define BITFIELD_MAX_LENGTH 64
28 typedef uint64_t bitpattern;
29 
30 struct bitfield {
31     int depth;
32     bitpattern *bits;
33 };
34 
35 struct bitfield * make_bitfield(const UChar *word, const UChar *alphabet);
36 
37 void free_bitfield(struct bitfield *bits);
38 
39 bool bf_contains(struct bitfield *a, struct bitfield *b);
40 
41 struct bitfield * bf_subtract(struct bitfield *a, struct bitfield *b);
42 
43 
44 struct bitfield * bf_normalize(struct bitfield *bf);
45 
46 
47 UChar *make_alphabet(const UChar *source);
48 
49 
50 
51 #endif /* BITFIELD_H */
52