diff --git a/rtl/inc/generic.inc b/rtl/inc/generic.inc index 009a40e0e8..5f2c1d7d6e 100644 --- a/rtl/inc/generic.inc +++ b/rtl/inc/generic.inc @@ -285,8 +285,8 @@ begin pend:=pword(high(PtrUInt)-sizeof(word)) else pend:=psrc+len; -{$ifdef FPC_REQUIRES_PROPER_ALIGNMENT} - if (ptruint(psrc) mod 2)<>0 then +{$ifdef FPC_REQUIRES_PROPER_ALIGNMENT} + if (ptruint(psrc) mod 2)<>0 then while psrc0) or (psrc^=0) or (pdest^=0) then - begin - if b<0 then - exit(-1) - else - exit(1); - end; + if b<0 then + exit(-1) + else if b>0 then + exit(1); + if (psrc^=0) or (pdest^=0) then + exit(0); inc(pdest); inc(psrc); end;