Delphi-Quellcode:
type
TSingleArray = array[0..sizeof(single)-1] of byte;
TSingleByteAlias = case byte of
0: (org: single);
1: (arr: TSingleArray);
end;
Delphi-Quellcode:
procedure ConvertSingleToByteArray(const ASingle: single; out AArray: TSingleArray);
var
lConvertHelper: TSingleByteAlias;
begin
lConvertHelper.org := ASingle;
AArray := lConvertHelper.arr;
end;
procedure ConvertByteArrayToSingle(const AArray: TSingleArray; out ASingle: single);
var
lConvertHelper: TSingleByteAlias;
begin
lConvertHelper.arr := AArray;
ASingle := lConvertHelper.org;
end;
Nur getippt, nicht getestet...