Read-only archive of the Armageddon Games Forums Archive (2000–2026) · About this archive

[1317] Bitwise NOT is wrong for variables and constants

4 replies · 1,000 views · Started 12 October 2010

const int TWO=2;

ffc script NOTTest
{
void run()
{
int two=2;

Trace(2);
Trace(two);
Trace(TWO);

TraceNL();

Trace(7&~2);
Trace(7&~two);
Trace(7&~TWO);

TraceNL();

Trace(~2);
Trace(~two);
Trace(~TWO);
}
}

2.0000
2.0000
2.0000

5.0000
7.0000
7.0000

-3.0000
-1.0000
-1.0000

Seems to be a compiler issue. do_bitwisenot() works fine.

ffc script NOTTest
{
void run()
{
int x=1;
int y=~x;
}
}

NOTTest
SETV d2,0
PUSHR d2
PUSHR d2
SETR d3,REFFFC
PUSHR d3
SETR d4,SP
SETV d2,1
SETR d6,d4
ADDV d6,2
STOREI d2,d6
SETR d6,d4
ADDV d6,2
LOADI d2,d6
BITNOT d2
SETR d6,d4
ADDV d6,1
STOREI d2,d6
SETV d3,0
POP d3
POP d3
QUIT

Which variable are you having trouble with here, Mr. Saffith?
And sorry if I moved this to the wrong forum by mistake...

Well, I was wrong. do_bitwisenot() was the problem, after all. 😛
Anyway, it's fixed now.

XMuppetSB wrote:Which variable are you having trouble with here, Mr. Saffith?

Those groups of three numbers in the output there? Each set should have been three of the same number.