Created
October 10, 2013 15:40
-
-
Save mbohun/6920490 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BitCollissionDetector { | |
private final int[] cdi_map; | |
public BitCollissionDetector(final int[] cm ) { | |
this.cdi_map = cm; | |
} | |
public boolean test(final int x, final int y ) { | |
final int column_bit_mask = 1<<(x>>5); //get proper constant, configurable? | |
final int row = y>>5; | |
return (this.cdi_map[row]&column_bit_mask) == column_bit_mask; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment