Thread: operators
View Single Post
  #3  
Old 11-05-2006, 06:07 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Shift, Invert and Xor are bit-operators. Graal handles all numbers internally as floating point values, but those operators are still interesting for some purposes. Integer numbers can be represented as fields of 32 bits, the first bit stands for 1, the second for 2, the third for 4, the fourth for 8 etc. Example: 10 is 8 + 2, so the bit representation is 1010 (we start reading from the right, the fields stand for 8421). Invert is inverting the bits, shift is moving the bits to the right or to the left (which is basicly multiplying with 2 or dividing by 2), and xor is combining two bit fields and the bits in the result are set when the bits of the two operands are unequal.
Reply With Quote