Posted Tue Oct 28, 2008 2:28 AM
Posted Tue Oct 28, 2008 7:03 AM
a ^ 1
Posted Wed Oct 29, 2008 3:00 AM
a{0} = !a{0} same as a ^
a{1} = !a{1} same as a ^ 1
a{2} = !a{2} same as a ^
a{3} = !a{3} same as a ^
a{4} = !a{4} same as a ^
a{5} = !a{5} same as a ^
a{6} = !a{6} same as a ^
a{7} = !a{7} same as a ^
Posted Wed Oct 29, 2008 4:16 AM
Posted Wed Oct 29, 2008 7:21 AM
Random Terrain, on Wed Oct 29, 2008 6:16 AM, said:
a = a ^ %xxxxxxxxwhere %xxxxxxxx is a bit pattern you want to flip a with. Anywhere there's a 0, the bit will be left as is. Anywhere there's a 1, the bit will be flipped. So for example if you wanted to flip bit 4, you would do
a = a ^ %00010000Bits 0-3, as well as bits 5-7, will stay as they are, and bit 4 will be flipped. You can also use decimal or hex values that represent the same bit pattern. For example
dim frame = a frame = 0 loop drawscreen frame = frame ^ 1 goto loopwill flip frame between 0 and 1, so you can tell whether you're on an odd frame or an even frame-- which would be useful if you were doing things that need to be split across two frames, and needed a way to tell if it's time to do stuff1 or stuff2.
Posted Wed Oct 29, 2008 7:34 AM
a{0} = !a{0} same as a = a ^ 1
a{1} = !a{1} same as a = a ^ 2
a{2} = !a{2} same as a = a ^ 4
a{3} = !a{3} same as a = a ^ 8
a{4} = !a{4} same as a = a ^ 16
a{5} = !a{5} same as a = a ^ 32
a{6} = !a{6} same as a = a ^ 64
a{7} = !a{7} same as a = a ^ 128
0 members, 0 guests, 0 anonymous users