On Sun, 6 Mar 2005 16:08:47 +0800
"Jin Tao" <[EMAIL PROTECTED]> wrote:

> 1. Macro BM_MIN_LENGTH and BM_BLOCK_SIZE are both defined value 3.  So
> this loop is actually run only once every time, why we use a loop
> structure here?

Because I've decided to leave the original structure for educational
purposes. The loop is eliminated by a compiler. Moreover the value of
BM_MIN_LENGTH will change when I implement regularity classifier
mentioned in TODO at the top of the source file.

> 2. And bm_shift[idx] is initialized as 1 in cli_bm_init() function.

The initial maximal shift is BM_MIN_LENGTH - BM_BLOCK_SIZE + 1 (i.e. 1
in our case) and it's the value of a maximal possible shift.

> Hence, the value of root->bm_shift[idx] must be larger than
> BM_MIN_LENGTH - BM_BLOCK_SIZE - i, which is negative.

This value will never be negative because BM_MIN_LENGTH >= BM_BLOCK_SIZE
and the initial i = BM_MIN_LENGTH - BM_BLOCK_SIZE and it's _decreasing_.
BM_MIN_LENGTH - BM_BLOCK_SIZE - i is an amount of shifting required to
get to the actual substring.

> Thanks a lot for your help!

You're welcome,

-- 
   oo    .....         Tomasz Kojm <[EMAIL PROTECTED]>
  (\/)\.........         http://www.ClamAV.net/gpg/tkojm.gpg
     \..........._         0DCA5A08407D5288279DB43454822DC8985A444B
       //\   /\              Sun Mar  6 15:49:39 CET 2005

Attachment: pgpRs96YUts5t.pgp
Description: PGP signature

_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html

Reply via email to