I will try and develop an example of this.
Thanks for your example!
Male
22 January 2012 - 09:08 PM
18 January 2012 - 02:54 AM
15 December 2011 - 04:28 AM
I don't think you understand how binary works. Your variable, int, equals 405. The 0's on the left don't change that. 405 in binary is 110010101.
So when you do int&001100, you're basically turning all bits except the 3rd and 4th from the right into 0's, leaving you with 000000100, which is 4. When you then do int&000011, you're left with 00000001, which is 1. So intx would be 4, and inty would be 1.
I think what you're trying to do would be better off done with modulo and integer division:
pack_xy(x, y)return x+y*256;
unpack_x(int)return (int mod 256);
unpack_y(int)return (int div 256);
-IMP
13 December 2011 - 04:02 AM
25 September 2011 - 01:41 AM
Community Forum Software by IP.Board
Licensed to: YoYo Games Ltd

Find content