source: trunk/symbol_table/bit_byte_group_strms.py @ 2106

Last change on this file since 2106 was 2106, checked in by ksherdy, 7 years ago

Added bit / byte strategy. Added length test to hash table.

File size: 995 bytes
Line 
1# demo
2import bitutil as pablo
3
4class Groups():
5        starts = 0
6        follows = 0
7        follows_7 = 0 # bit
8        follows_0 = 0 # byte
9
10def Gen_lgth_groups(groups):
11
12        # Groups symbols of length 1 to length 7
13
14        follows_gt_0 = groups.follows
15
16        follows_mask_1_2 = pablo.Advance(groups.starts) | pablo.Advance(pablo.Advance(groups.starts))
17
18        follows_mask_3_4 = pablo.Advance(pablo.Advance(follows_mask_1_2))
19        follows_mask_5_6 = pablo.Advance(pablo.Advance(follows_mask_3_4))
20        follows_mask_6_7 = pablo.Advance(follows_mask_5_6)
21        follows_mask_1_7 = follows_mask_1_2 | follows_mask_3_4 | follows_mask_5_6 | follows_mask_6_7
22
23        # Naive Advance
24        groups.follows_7 = follows_gt_0 & follows_mask_1_7
25
26        # Advance 32 and Interpose
27        #temp32 = pablo.Advance32 (follows_mask_1_7)
28        #groups.follows_16 = follows_gt_8 & interpose32 (follows_mask_1_7, temp32, 7)
29
30        follows_gt_7 = follows_gt_0 &~ groups.follows_7
31
32        # Groups symbols of length greater than 7
33        groups.follows_0 = follows_gt_7
34
35
36def Main(groups):
37        Gen_lgth_groups(groups)
38
Note: See TracBrowser for help on using the repository browser.