mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 11:45:32 +02:00
[PATCH 109/188] writing out binary float-point
From 814363bcc1c03513bc0db08d347a32c5e6883c06 Mon Sep 17 00:00:00 2001 From: Dmitry Boyarintsev <skalogryz.lists@gmail.com> Date: Wed, 18 Mar 2020 08:47:16 -0400 git-svn-id: branches/wasm@46105 -
This commit is contained in:
parent
861f7c67a8
commit
d557557e1c
@ -571,6 +571,30 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure WriteF32Operand(dst: TStream; const txt: string);
|
||||||
|
var
|
||||||
|
f : single;
|
||||||
|
err : integer;
|
||||||
|
begin
|
||||||
|
//todo: float point parsing!
|
||||||
|
f:=0;
|
||||||
|
Val(txt, f, err);
|
||||||
|
// valid or not, it still should write out the value
|
||||||
|
dst.Write(f, sizeof(f));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure WriteF64Operand(dst: TStream; const txt: string);
|
||||||
|
var
|
||||||
|
f : double;
|
||||||
|
err : integer;
|
||||||
|
begin
|
||||||
|
//todo: float point parsing!
|
||||||
|
f:=0;
|
||||||
|
Val(txt, f, err);
|
||||||
|
dst.Write(f, sizeof(f));
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TBinWriter.WriteInstList(list: TWasmInstrList; ofsAddition: LongWord);
|
procedure TBinWriter.WriteInstList(list: TWasmInstrList; ofsAddition: LongWord);
|
||||||
var
|
var
|
||||||
i : integer;
|
i : integer;
|
||||||
@ -597,6 +621,9 @@ begin
|
|||||||
WriteI64Operand(dst, ci.operandText);
|
WriteI64Operand(dst, ci.operandText);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
ipf32: WriteF32Operand(dst, ci.operandText);
|
||||||
|
ipf64: WriteF64Operand(dst, ci.operandText);
|
||||||
|
|
||||||
ipi32OrFunc: begin
|
ipi32OrFunc: begin
|
||||||
if ci.hasRelocIdx then
|
if ci.hasRelocIdx then
|
||||||
// should have been populated with Normalize
|
// should have been populated with Normalize
|
||||||
|
Loading…
Reference in New Issue
Block a user