Skip to content

Instantly share code, notes, and snippets.

@mbohun
Created October 10, 2013 15:40
Show Gist options
  • Save mbohun/6920490 to your computer and use it in GitHub Desktop.
Save mbohun/6920490 to your computer and use it in GitHub Desktop.
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