LCL: fixed MissingBits for low precision

git-svn-id: trunk@10577 -
This commit is contained in:
mattias 2007-02-04 23:14:29 +00:00
parent c02a3a6b04
commit b40adae3c8

View File

@ -827,24 +827,30 @@ begin
begin begin
for HighValue := 0 to 7 do for HighValue := 0 to 7 do
begin begin
// Value represents the three highest bits // HighValue represents the three highest bits
// For example: // For example:
// Prec=5 and the read value is %10110 // Prec=5 and the read value is %10110
// => Value=%101 // => HighValue=%101
// copy the value till all missing bits are set // copy the HighValue till all missing bits are set
// For example: // For example:
// Prec=5, HighValue=%110 // Prec=5, HighValue=%110
// => MissingBits[5,6]:=%0000011011011011 // => MissingBits[5,6]:=%0000011011011011
// because 00000 110 110 110 11
MissingBits[Prec, HighValue] := 0; MissingBits[Prec, HighValue] := 0;
if Prec = 0 then Continue; if Prec = 0 then Continue;
if Prec >= 3 then DShift := 3
else DShift := Prec; if Prec>=3 then begin
DShift := 3;
Bits := HighValue; Bits := HighValue;
end else begin
DShift := Prec;
Bits := HighValue shr (3-Prec);
end;
CurShift := 16 - Prec; CurShift := 16 - Prec;
while CurShift > 0 do while CurShift > 0 do
begin begin
//DebugLn(['InternalInit CurShift=',CurShift,' DShift=',DShift]);
if CurShift >= DShift then if CurShift >= DShift then
MissingBits[Prec, HighValue] := MissingBits[Prec, HighValue] :=
MissingBits[Prec, HighValue] or (Bits shl (CurShift - DShift)) MissingBits[Prec, HighValue] or (Bits shl (CurShift - DShift))