mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-03 23:20:27 +02:00
* Fixed upper limit in tbits.findnextbit, Mantis #25398.
git-svn-id: trunk@26754 -
This commit is contained in:
parent
0f7e1af3bb
commit
6c66b8ffe3
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -13807,6 +13807,7 @@ tests/webtbs/tw25332a.pp svneol=native#text/plain
|
||||
tests/webtbs/tw25349.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2536.pp svneol=native#text/plain
|
||||
tests/webtbs/tw25361.pp svneol=native#text/plain
|
||||
tests/webtbs/tw25398.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2540.pp svneol=native#text/plain
|
||||
tests/webtbs/tw25494.pp svneol=native#text/plain
|
||||
tests/webtbs/tw25551.pp svneol=native#text/plain
|
||||
|
@ -319,16 +319,14 @@ end;
|
||||
function TBits.FindNextBit : longint;
|
||||
var
|
||||
loop : longint;
|
||||
maxVal : longint;
|
||||
begin
|
||||
result := -1; { will occur only if no other bits set to }
|
||||
{ current findState }
|
||||
|
||||
if findIndex > -1 then { must have called FindFirstBit first }
|
||||
begin { or set the start index }
|
||||
maxVal := (FSize * 32) - 1;
|
||||
|
||||
for loop := findIndex + 1 to maxVal do
|
||||
for loop := findIndex + 1 to FBSize-1 do
|
||||
begin
|
||||
if get(loop) = findState then
|
||||
begin
|
||||
|
26
tests/webtbs/tw25398.pp
Normal file
26
tests/webtbs/tw25398.pp
Normal file
@ -0,0 +1,26 @@
|
||||
{$mode objfpc}{$h+}
|
||||
uses classes;
|
||||
|
||||
var
|
||||
b: tbits;
|
||||
i: integer;
|
||||
|
||||
begin
|
||||
b:= TBits.Create;
|
||||
b.Size:= 128;
|
||||
b.SetOn(0);
|
||||
b.SetOn(13);
|
||||
b.SetOn(118);
|
||||
i:= b.FindFirstBit(True);
|
||||
if i<>0 then
|
||||
halt(1);
|
||||
i:= b.FindNextBit;
|
||||
if i<>13 then
|
||||
halt(2);
|
||||
i:= b.FindNextBit;
|
||||
if i<>118 then
|
||||
halt(3);
|
||||
i:= b.FindNextBit;
|
||||
if i<>-1 then
|
||||
halt(4);
|
||||
end.
|
Loading…
Reference in New Issue
Block a user