This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!

# Diff of /trunk/doc/exact_match.txt

revision 299 by dpavlin, Sun Apr 4 20:48:56 2004 UTC revision 300 by dpavlin, Sun Apr 4 21:04:47 2004 UTC
# Line 30  on TitleAndResponsibility, you would use Line 30  on TitleAndResponsibility, you would use
30
32
33  Bit-mask is usage of one byte (8 bits) as 8 separate bits with it's own meaning.  Bit-mask is usage of one byte (8 bits) as 8 separate bits with it's own
34  So, 1 = 2^1, thus it's bit 1. So, for 1-3 we have:  meaning (this is simplification, but bear with me for now).
35
36    So, 1 = 2^0, thus it's bit 1. With analogy, 2=2^1 and 3=2^0+2^1.
37    So, for 1-3 we use two bits and have:
38
39  number  bits  number  bits
40  1       01  1       01      (just begin bit set)
41  2       10  2       10      (just end bit set)
42  3       11  3       11      (begin and end bit set)
43
44  For that we are using two bits. If we want to produce wild-card match, we use  Thus, with two bits (and values 1-3) we can express should we exact match from
45  bit 3 (2^3 = 4) so we have:  beginning, end or both. For wild-card match, we use additional bit 3 (2^3 = 4)
46    so we have:
47
48  number  bits  number  bits    exact match
49  1       001     begin  1       001     begin
50  2       010     end  2       010     end
51  3       011     begin+end  3       011     begin+end
# Line 49  number bits Line 53  number bits
53  5       101     (4+1) begin+wild-card  5       101     (4+1) begin+wild-card
54  6       110     (4+2) end+wild-card  6       110     (4+2) end+wild-card
55  7       111     (4+3) begin+end+wild-card  7       111     (4+3) begin+end+wild-card
56

Legend:
 Removed from v.299 changed lines Added in v.300