瀏覽代碼

* do not copy sets in fpc_varset_(un)set if source and dest are the same

florian 1 年之前
父節點
當前提交
edaee6f392
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      rtl/inc/genset.inc

+ 4 - 2
rtl/inc/genset.inc

@@ -94,7 +94,8 @@ procedure fpc_varset_set(const source;var dest; b,size : ptrint); compilerproc;
   type
     tbsetarray = bitpacked array[0..high(sizeint)-1] of 0..1;
   begin
-    move(source,dest,size);
+    if @source<>@dest then
+      move(source,dest,size);
     tbsetarray(dest)[b]:=1;
   end;
 {$endif ndef FPC_SYSTEM_HAS_FPC_VARSET_SET_BYTE}
@@ -109,7 +110,8 @@ procedure fpc_varset_unset(const source;var dest; b,size : ptrint); compilerproc
   type
     tbsetarray = bitpacked array[0..high(sizeint)-1] of 0..1;
   begin
-    move(source,dest,size);
+    if @source<>@dest then
+      move(source,dest,size);
     tbsetarray(dest)[b]:=0;
   end;
 {$endif ndef FPC_SYSTEM_HAS_FPC_VARSET_UNSET_BYTE}