Skip to content

Instantly share code, notes, and snippets.

@alexzuza
Created January 29, 2019 07:43
Show Gist options
  • Save alexzuza/6ed661c64a9c366b6b41668b658d07a6 to your computer and use it in GitHub Desktop.
Save alexzuza/6ed661c64a9c366b6b41668b658d07a6 to your computer and use it in GitHub Desktop.
Di bloom
// Use the raw bloomBit number to determine which bloom filter bucket we should check
// e.g: bf0 = [0 - 31], bf1 = [32 - 63], bf2 = [64 - 95], bf3 = [96 - 127], etc
const b7 = bloomBit & 0x80;
const b6 = bloomBit & 0x40;
const b5 = bloomBit & 0x20;
const tData = tView.data as number[];
if (b7) {
b6 ? (b5 ? (tData[injectorIndex + 7] |= mask) : (tData[injectorIndex + 6] |= mask)) :
(b5 ? (tData[injectorIndex + 5] |= mask) : (tData[injectorIndex + 4] |= mask));
} else {
b6 ? (b5 ? (tData[injectorIndex + 3] |= mask) : (tData[injectorIndex + 2] |= mask)) :
(b5 ? (tData[injectorIndex + 1] |= mask) : (tData[injectorIndex] |= mask));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment