On Mar 01, 2005, at 16:05, Tomasz Kojm wrote:

On Tue, 1 Mar 2005 15:56:51 -0500
Dale Walsh <[EMAIL PROTECTED]> wrote:

62.25k (127488 - DHASH( 211 *256 + 37 * 256 + 256))

Upon what have you based this (incorrect) calculation?

--
   oo    .....         Tomasz Kojm <[EMAIL PROTECTED]>

This calculation was based on the code from matcher-bm.c "#define DHASH(a,b,c) 211 * a + 37 * b + c"


The value returned from DHASH(256,256,256) is 63744 or 62.25k so how can my calculation be wrong if this is what you wrote.

Try this.

pico dhash.c

/*******************************************************
 *
 *  test of  DHASH(a,b,c) 211 * a + 37 * b + c
 *
 *******************************************************/

#include <stdio.h>

#define DHASH(a,b,c) 211 * a + 37 * b + c

int main (int argc, char * const argv[]){
int a, b, c;
a=strtol(argv[1], 0, 10);
b=strtol(argv[2], 0, 10);
c=strtol(argv[3], 0, 10);

int size = DHASH(a,b,c);
printf("value is: %7d\n",size);

}

____________________________________________________________

compile with gcc dhash.c -o dhash

____________________________________________________________

./dhash 256 256 256

results is 63744

./dhash 528 528 128

results is 131072

./dhash 621 0 41

result is 131072

Based on your routine my calculations are correct and can be verified with a calculator.
____________________________________________________________


Also, what about the additional change I made to clI_bm_free(), was it appropriate to make it the same?

If not why?

Here are the actual changes I made to matcher-bm.c in case you aren't sure what I'm talking about.
_____________________________________________________________________


int cli_bm_init(struct cl_node *root)
{
        int i;
//      unsigned int size = DHASH(256, 256, 256);
        unsigned int size = 131072;

[snip...]

void cli_bm_free(struct cl_node *root)
{
        struct cli_bm_patt *b1, *b2;
        int i;
//      unsigned int size = DHASH(256, 256, 256);
        unsigned int size = 131072;

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

Reply via email to