Browse Source

[PATCH 084/188] update writing out a constant value

From e6c40ff6530c403dcee9ad36b3991e6f36be8267 Mon Sep 17 00:00:00 2001
From: Dmitry Boyarintsev <[email protected]>
Date: Mon, 9 Mar 2020 11:11:43 -0400

git-svn-id: branches/wasm@46080 -
nickysn 5 years ago
parent
commit
553e32eb1e
1 changed files with 7 additions and 6 deletions
  1. 7 6
      utils/wasmbin/wasmbinwriter.pas

+ 7 - 6
utils/wasmbin/wasmbinwriter.pas

@@ -476,13 +476,14 @@ begin
     dst.WriteByte(ci.code);
     case INST_FLAGS[ci.code].Param of
       ipi32: begin
-        Val(ci.operandText, u32, err);
-        if err = 0 then begin
+        Val(ci.operandText, i32, err);
+        if err = 0 then
+          u32 := LongWord(i32)
+        else
+          Val(ci.operandText, u32, err);
+
+        if err = 0 then
           WriteU32(dst, u32);
-        end else begin
-          Val(ci.operandText, i32, err);
-          if err = 0 then WriteU32(dst, i32);
-        end;
       end;
 
       ipi64,     // signed Leb of maximum 8 bytes