X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=doc%2Fexact_match.txt;h=2dbb2779e0076c50003d4bc6ab94ebc66226cab9;hb=d0ecbc408bf94fb0a9dd2ef74ffa5e9aeadad7ec;hp=d7495520f5924214cfb1926bb5aa4635ff0adcc1;hpb=c703c3a9a21fa7d1051d52c10466fc6ff8f5982e;p=webpac diff --git a/doc/exact_match.txt b/doc/exact_match.txt index d749552..2dbb277 100644 --- a/doc/exact_match.txt +++ b/doc/exact_match.txt @@ -27,3 +27,30 @@ 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 (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 (just begin bit set) +2 10 (just end bit set) +3 11 (begin and end bit set) + +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 exact match +1 001 begin +2 010 end +3 011 begin+end +4 100 (not used) +5 101 (4+1) begin+wild-card +6 110 (4+2) end+wild-card +7 111 (4+3) begin+end+wild-card +