<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 30/10/12 14:26, ik wrote:
<blockquote
cite="mid:CAOccsKDD+ERXY6Y2SxcQJka=MweGB40xbgP2nQ5QQnkF-U=VcA@mail.gmail.com"
type="cite">
<pre wrap="">Hello,
I have the following function:
function OneToTwoComplement(AValue: QWord): QWord;
begin
Result := (AValue xor $FFFFFFFFFFFFFFFF) + 1;
end;
What am I missing here that makes the compiler complain about "Range
check error while evaluating constants" ?
Why doesn't it complain on :
function OneToTwoComplement(AValue: Int64): Int64;
begin
Result := (Abs(AValue) xor $FFFFFFFFFFFFFFFF) + 1;
end;
Thanks,
Ido
_______________________________________________
fpc-pascal maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal">http://lists.freepascal.org/mailman/listinfo/fpc-pascal</a>
</pre>
</blockquote>
<font size="-1"><br>
See <a class="moz-txt-link-freetext" href="http://mantis.freepascal.org/view.php?id=21284">http://mantis.freepascal.org/view.php?id=21284</a><br>
<br>
You need something like <br>
</font>
<pre wrap="">function OneToTwoComplement(AValue: QWord): QWord;
begin
Result := (AValue xor Qword($FFFFFFFFFFFFFFFF)) + 1;
end;
</pre>
<br>
</body>
</html>