function TAclasencode.BufToDataBIN(const Buf: TByteDynArray; iStartPos, iLen, iDec: Integer): Variant; const DefaultLen = 8; var i : Integer; iTmp : Int64; arr : array[0..7]of Byte; pInt64 : ^Int64; fTmp : Double; begin fTmp := 0; try FillChar(arr,8,0); if (Buf[iStartPos] and $80=$80) and (not IsCardinal) then begin if Negative then begin for I:=0 to iLen-2 do arr[I]:=(Buf[iStartPos+iLen-1-I] xor $FF); pInt64:=@arr[0]; iTmp:=pInt64^+1; end else begin for I:=0 to iLen-2 do arr[I]:=(Buf[iStartPos+iLen-1-I]); pInt64:=@arr[0]; iTmp:=pInt64^; end; fTmp:=iTmp; fTmp:=fTmp/Power(10,iDec); fTmp:=0-fTmp; end else begin for I:=0 to iLen-1 do arr[I]:=(Buf[iStartPos+iLen-1-I]); pInt64:=@arr[0]; iTmp:=pInt64^; fTmp:=iTmp; fTmp:=fTmp/Power(10,iDec); end; finally Result := fTmp; end; end;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)