plane check

Hey people.
I need help with this:

I have a chessboard on XZ real plane (world).
Each tile of the pattern is of size 64*64;
How can I check what is the color of point (x,z) (white or black) ??
How can I make it efficient in C code ??

Thanks a lot.

bah, dont worry i have a headache and my answer was a little bit crap… ill post it again when i can think straight…

[This message has been edited by MrShoe (edited 01-17-2002).]

Some integer bitlevel hack is usefull here.

You have to look at the bit that’s worth 64, that is, the 6:th bit. Extract the 6:th bit from the coordinates, and XOR them. The result indicates whether the square is black or white.

int a = xCoordinate & 64;
int b = yCooridnate & 64;
int c = a ^ b; // ^ is the bitwise XOR operator
if(c == 0) color = black;
else color = white;

Just a note. This piece of code assumes you have a black square on coorinate (0 to 63, 0 to 63). If you have a white square there instead, just swap the two colors in the if-statement.