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 / Bit operations

Author
Message
serandre
12
Years of Service
User Offline
Joined: 14th Sep 2012
Location:
Posted: 30th Sep 2012 15:56
I didnĀ“t find bit operations in the AppGameKit language docs. It could be a good idea to include them in the next update:

Shift left/right bit operations, AND, OR, XOR

x = x << 1 rem x = x * 2
x = >> 4 rem x = x / 16

This could make a boost in performance for intensive integer maths operations.
MarcoBruti
13
Years of Service
User Offline
Joined: 20th Nov 2011
Location: Caput Mundi
Posted: 30th Sep 2012 16:33
check help-on-line under "Principles".
Quote: "
BITWISE LSHIFT using two less-than symbols shift bits 1 space to the left.
%0111 << 1 becomes %1110.
BITWISE RSHIFT using two greater-than symbols shift bits 1 space to the right.
%0111 becomes %0011.
BITWISE AND signified by the symbol && will AND all bits of one value with another.
%1111 && %0011 becomes %0011.
BITWISE OR signified by the symbol || will OR all bits of one value with another.
%1111 >> 1|| %0011 becomes %1111.
BITWISE XOR signified by the symbol ~~ will XOR all bits of one value with another.
%1111 ~~ %0011 becomes %1100.
BITWISE NOT signified by the symbol .. will NOT all bits of the right value.
%1111 .. %1010 becomes %0101.
"

Login to post a reply

Server time is: 2024-11-23 23:48:53
Your offset time is: 2024-11-23 23:48:53