Initial import of XMLTree
[SXSI/XMLTree.git] / libcds / src / static_sequence / wt_coder_binary.cpp
1
2 #include <wt_coder_binary.h>
3
4 wt_coder_binary::wt_coder_binary(uint * seq, uint n, alphabet_mapper * am) {
5         uint max_v = 0;
6   for(uint i=0;i<n;i++)
7     max_v = max(am->map(seq[i]),max_v);
8   h=bits(max_v);
9 }
10
11 wt_coder_binary::~wt_coder_binary() {}
12
13 bool wt_coder_binary::is_set(uint symbol, uint l) {
14         if((1<<(h-l-1))&symbol) return true;
15         return false;
16 }
17
18 bool wt_coder_binary::done(uint symbol, uint l) {
19         if(l==h-1) return true;
20         return false;
21 }
22
23 uint wt_coder_binary::size() {
24   return sizeof(wt_coder_binary);
25 }
26