0

In previous versions of Delphi (we use Delphi 2009), the TFloatRec record (used in floatToDecimal) was defined as

 TFloatRec = packed record
    Exponent: Smallint;
    Negative: Boolean;
    Digits: array[0..20] of AnsiChar;
 end;

However in Delphi XE5 (and I think this may have changed in XE3), it is defined as ..

 TFloatRec = packed record
    Exponent: Smallint;
    Negative: Boolean;
    Digits: array[0..20] of Byte;
  end;

We use this record to convert an extended field to a RawByteString, can anyone suggest what I can do to convert the results of the call to FloatToDecimal into a RawByteString.

Context

This method is called whilst reading a buffer from a network communication, so it needs to be as quick as possible, without converting codepages, etc.

4

1 回答 1

4

您可以重新声明 D2009 记录以供自己使用:

type
  TMyFloatRec = packed record
    Exponent: Smallint;
    Negative: Boolean;
    Digits: array[0..20] of AnsiChar;
  end;

切换您现有的代码以使用此记录,一切都会好起来的。

尽管使用新版本的TFloatRec. 毕竟 aByte和 anAnsiChar的大小相同,您可以轻松地在一个和另一个之间转换。

于 2013-09-30T20:10:03.000 回答