Browse Source

* WebAssembly internal object writer: fixed helper function SlebSize()

Nikolay Nikolov 11 months ago
parent
commit
d41d98b70b
1 changed files with 4 additions and 1 deletions
  1. 4 1
      compiler/wasm32/aasmcpu.pas

+ 4 - 1
compiler/wasm32/aasmcpu.pas

@@ -2071,12 +2071,15 @@ uses
     function taicpu.Pass1(objdata: TObjData): longint;
     function taicpu.Pass1(objdata: TObjData): longint;
 
 
         function SlebSize(v: tcgint): longint;
         function SlebSize(v: tcgint): longint;
+          var
+            b: byte;
           begin
           begin
             result:=0;
             result:=0;
             repeat
             repeat
+              b:=byte(v) and 127;
               v:=SarInt64(v,7);
               v:=SarInt64(v,7);
               Inc(result);
               Inc(result);
-            until ((v=0) and ((byte(v) and 64)=0)) or ((v=-1) and ((byte(v) and 64)<>0));
+            until ((v=0) and ((b and 64)=0)) or ((v=-1) and ((b and 64)<>0));
           end;
           end;
 
 
         function UlebSize(v: tcgint): longint;
         function UlebSize(v: tcgint): longint;