diff options
author | peter <peter@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2007-11-05 21:15:50 +0000 |
---|---|---|
committer | peter <peter@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2007-11-05 21:15:50 +0000 |
commit | 23e2aea044fe836b7fc74f269d0712ed38c3de8c (patch) | |
tree | ae58bb62b609ba2a39f0de61a5590a9228348db8 /tests/bench | |
parent | 29e6c6c34d11da5324cb095322cee8f7a39e99eb (diff) | |
download | fpc-23e2aea044fe836b7fc74f269d0712ed38c3de8c.tar.gz |
* fixed off-by-one by S. Fisher
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@9144 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'tests/bench')
-rw-r--r-- | tests/bench/shootout/src/regexdna.pp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/bench/shootout/src/regexdna.pp b/tests/bench/shootout/src/regexdna.pp index 3a60a570ee..e439b3691f 100644 --- a/tests/bench/shootout/src/regexdna.pp +++ b/tests/bench/shootout/src/regexdna.pp @@ -2,6 +2,7 @@ http://shootout.alioth.debian.org contributed by Steve Fisher + modified by Peter Vreman compile with fpc -O3 regex-dna.pp @@ -24,14 +25,14 @@ begin end; count := 0; dest := ''; - starti:=0; + starti := 1; pstart := pchar(str); - while starti < length(str) do + while starti <= length(str) do begin if RegExprPos(engine, pstart, index, size ) then begin inc(count); - dest:=dest+Copy( str, starti, index) + repl; + dest := dest + Copy( str, starti, index) + repl; inc(pstart,index+size); inc(starti,index+size); end @@ -58,8 +59,8 @@ begin end; count := 0; pstart := pchar(str); - starti := 0; - while starti<length(str) do + starti := 1; + while starti <= length(str) do begin if RegExprPos(engine, pstart, index, size ) then begin |