Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / BUG: Inverse Bits Using Binary Inverse Operator

Author
Message
Muckypaws
AGK Developer
13
Years of Service
User Offline
Joined: 21st Oct 2011
Location:
Posted: 24th Jan 2015 15:28
Hi,

AGK 2.0.10 in the manual states

BITWISE NOT signified by the symbol ! will NOT all bits of the right value.
!%1010 becomes %0101

However, if I take the following sample



notMask contains the value 0 and not %11111111111111111111111111111011

Which I would expect.

Is my understanding correct as the (..) operator was removed from V2, I can work around it, but makes for inefficient code.

Cheers
Jason
www.wonkypix.com

http://itunes.apple.com/us/app/newtons-nonsense/id473520354?ls=1&mt=8
paulrobson
10
Years of Service
User Offline
Joined: 22nd Nov 2014
Location: Norfolk, England
Posted: 24th Jan 2015 17:00
Yes, you are correct. I think this is a bug, ! is behaving as logical not (e.g. returns zero for everything except zero where it returns 1), I have added it to the bug list. The code in the interpreter is right, so it is probably compiling ! to AGKI_BOOL_NOT and it should be AGKI_NOT.

You can work round it by using bitwise XOR which does work, e.g. notMask = mask ~~ -1 - this does the same thing and appears to work - this has the added advantage that you can limit the resulting bitmask size (maybe).

Login to post a reply

Server time is: 2024-11-25 17:22:39
Your offset time is: 2024-11-25 17:22:39