Browse Source

[PATCH 77/83] using decimal format for float-point as hex binary isn't supported by wat2wasm

From a919888638235f7848a9045bc5dc89093deb0072 Mon Sep 17 00:00:00 2001
From: Dmitry Boyarintsev <[email protected]>
Date: Tue, 29 Oct 2019 10:38:21 -0400

git-svn-id: branches/wasm@45954 -
nickysn 5 years ago
parent
commit
1ff7756d84
1 changed files with 7 additions and 5 deletions
  1. 7 5
      compiler/wasm/agwat.pas

+ 7 - 5
compiler/wasm/agwat.pas

@@ -160,7 +160,8 @@ implementation
 
      function constsingle(s: single): ansistring;
        begin
-         result:='0x'+hexstr(longint(t32bitarray(s)),8);
+         // wat2wasm is using strtof() internally
+         str(s, result); //'0x'+hexstr(longint(t32bitarray(s)),8);
        end;
 
      function constdouble(d: double): ansistring;
@@ -169,10 +170,11 @@ implementation
           // integer, we never have to swap the endianess). We have to
           // include the sign separately because of the way Java parses
           // hex numbers (0x8000000000000000 is not a valid long)
-         result:=hexstr(abs(int64(t64bitarray(d))),16);
-         if int64(t64bitarray(d))<0 then
-           result:='-'+result;
-         result:='0dx'+result;
+          //result:=hexstr(abs(int64(t64bitarray(d))),16);
+          //if int64(t64bitarray(d))<0 then
+          //  result:='-'+result;
+          //result:='0dx'+result;
+          str(d, result);
         end;
 
     function getopstr(const o:toper) : ansistring;