Is this way to convert 4 bytes array into a single in Delphi?
type
RFloatToBytes = packed record
case IsFloat: Boolean of
True: (SingleVal: Single);
False: (ByteVals: array[0..3] of Byte);
end;
…
function XP_BytesToSingle( Const B: array of Byte): Single;
Var Locale:RFloatToBytes;
begin
Locale.ByteVals[0] := B[0];
Locale.ByteVals[1] := B[1];
Locale.ByteVals[2] := B[2];
Locale.ByteVals[3] := B[3];
Result := Locale.SingleVal;
end;
Tried to find a function like
function BytesTointo….
into unit IdGlobal
but no conversion is provided for float, extended, single.
Thank you endeed.
Giovanni