even more detail explanation
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 4 Apr 2004 21:04:47 +0000 (21:04 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 4 Apr 2004 21:04:47 +0000 (21:04 +0000)
git-svn-id: file:///home/dpavlin/private/svn/webpac/trunk@300 13eb9ef6-21d5-0310-b721-a9d68796d827

doc/exact_match.txt

index 472cb28..2dbb277 100644 (file)
@@ -30,18 +30,22 @@ on TitleAndResponsibility, you would use:
 
 What are bit-masks?
 
-Bit-mask is usage of one byte (8 bits) as 8 separate bits with it's own meaning.
-So, 1 = 2^1, thus it's bit 1. So, for 1-3 we have:
+Bit-mask is usage of one byte (8 bits) as 8 separate bits with it's own
+meaning (this is simplification, but bear with me for now).
+
+So, 1 = 2^0, thus it's bit 1. With analogy, 2=2^1 and 3=2^0+2^1. 
+So, for 1-3 we use two bits and have:
 
 number bits
-1      01
-2      10
-3      11
+1      01      (just begin bit set)
+2      10      (just end bit set)
+3      11      (begin and end bit set)
 
-For that we are using two bits. If we want to produce wild-card match, we use
-bit 3 (2^3 = 4) so we have:
+Thus, with two bits (and values 1-3) we can express should we exact match from
+beginning, end or both. For wild-card match, we use additional bit 3 (2^3 = 4)
+so we have:
 
-number bits
+number bits    exact match
 1      001     begin
 2      010     end
 3      011     begin+end
@@ -49,3 +53,4 @@ number        bits
 5      101     (4+1) begin+wild-card
 6      110     (4+2) end+wild-card
 7      111     (4+3) begin+end+wild-card
+