* small speed improvements

git-svn-id: trunk@13740 -
This commit is contained in:
andrew 2009-09-19 01:19:35 +00:00
parent 2db72437e8
commit 5c64c75dd7
2 changed files with 4 additions and 4 deletions

View File

@ -1081,7 +1081,7 @@ begin
Exit; Exit;
end; end;
// if FirstBlock is odd (1,3,5,7 etc) we have to read the even block before it first. // if FirstBlock is odd (1,3,5,7 etc) we have to read the even block before it first.
if (FirstBlock <> 0) and (FirstBlock mod 2 > 0) then begin if FirstBlock and 1 = 1 then begin
fStream.Position := fHeaderSuffix.Offset + fCachedEntry.ContentOffset + (ResetTable[FirstBLock-1]); fStream.Position := fHeaderSuffix.Offset + fCachedEntry.ContentOffset + (ResetTable[FirstBLock-1]);
ReadCount := ResetTable[FirstBlock] - ResetTable[FirstBlock-1]; ReadCount := ResetTable[FirstBlock] - ResetTable[FirstBlock-1];
BlockWriteLength:=BlockSize; BlockWriteLength:=BlockSize;
@ -1131,7 +1131,7 @@ begin
end; end;
// if the next block is an even numbered block we have to reset the decompressor state // if the next block is an even numbered block we have to reset the decompressor state
if (X < LastBlock) and (X mod 2 > 0) then LZXreset(LZXState); if (X < LastBlock) and (X and 1 = 1) then LZXreset(LZXState);
end; end;
FreeMem(OutBuf); FreeMem(OutBuf);
@ -1238,7 +1238,7 @@ AChm: TChmReader;
AIndex: Integer; AIndex: Integer;
begin begin
if not FileExists(AFileName) then exit; if not FileExists(AFileName) then exit;
AStream := TFileStream.Create(AFileName, fmOpenRead); AStream := TFileStream.Create(AFileName, fmOpenRead, fmShareDenyWrite);
AChm := TChmReader.Create(AStream, True); AChm := TChmReader.Create(AStream, True);
AIndex := AddObject(AFileName, AChm); AIndex := AddObject(AFileName, AChm);
fLastChm := AChm; fLastChm := AChm;

View File

@ -593,7 +593,7 @@ begin
i := bits.read(16, inpos); i := bits.read(16, inpos);
j := bits.read(16, inpos); j := bits.read(16, inpos);
end; end;
pState^.intel_filesize := (i shl 16) or j; ///* or 0 if not encoded */ pState^.intel_filesize := LongInt((i shl 16) or j); ///* or 0 if not encoded */
pState^.header_read := 1; pState^.header_read := 1;
end; end;