changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > ventivac / changeset: use min/max blocksize correctly, previously did not take window into account

changeset 62: 29e265a144f7
parent 61: fc315481eafc
child 63: 9519bb640170
author: Mechiel Lukkien <mechiel@ueber.net>
date: Fri, 13 Jul 2007 16:34:26 +0200
files: appl/lib/rabin.b
description: use min/max blocksize correctly, previously did not take window into account
     1.1--- a/appl/lib/rabin.b	Fri Jul 13 16:10:04 2007 +0200
     1.2+++ b/appl/lib/rabin.b	Fri Jul 13 16:34:26 2007 +0200
     1.3@@ -48,7 +48,7 @@
     1.4 		return (nil, sprint("bad minx/max"));
     1.5 	if(min < rcfg.width)
     1.6 		return (nil, "min < width");
     1.7-	c := ref Rfile(b, rcfg, min, max, array[max] of byte, 0, 0, big 0);
     1.8+	c := ref Rfile(b, rcfg, min, max, array[max+rcfg.width] of byte, 0, 0, big 0);
     1.9 
    1.10 say(sprint("min=%d max=%d", min, max));
    1.11 
    1.12@@ -89,7 +89,7 @@
    1.13 		new := (prime * (c.state - c.rcfg.tab[int c.buf[c.n-width]]) + ch) & (mod-1);
    1.14 		c.n++;
    1.15 		c.state = new;
    1.16-		if(c.n >= c.max || (c.n >= c.min && (new & mask) == 0)) {
    1.17+		if(c.n-width >= c.max || (c.n-width >= c.min && (new & mask) == 0)) {
    1.18 			d := array[c.n-width] of byte;
    1.19 			d[:] = c.buf[:len d];
    1.20 			off := c.off;