Adapting .js Bloom Filter
I'm interested in playing around with Bloom filters. I found this javascript implementation https://github.com/jasondavies/bloomfilter.js/blob/master/bloomfilter.js, but my understanding of javascript is a bit minimal.
So I'm not quite sure what all the part about the different kinds of typed arrays supported by javascript and what would be the best thing to use in Flash. Would it be array, vector, object? Or perhaps it could be something that I wouldn't normally think of like a bitmapdata or byte array?
Also I'm often not sure which number types I should use to get the best results. I'm guessing generally uint to take advantage of the 32 bits.
Also I'm wondering a little about the FNV hashing function. Given that I'll be hashing strings I'm wondering how often I would need to use the masking like:
while (++i < n) {
c = v.charCodeAt(i);
if (d = c & 0xff000000) {
a ^= d >> 24;
a += (a << 1) + (a << 4) + (a << 7) + (a << 8) + (a << 24);
}
if (d = c & 0xff0000) {
a ^= d >> 16;
a += (a << 1) + (a << 4) + (a << 7) + (a << 8) + (a << 24);
}
if (d = c & 0xff00) {
a ^= d >> 8;
a += (a << 1) + (a << 4) + (a << 7) + (a << 8) + (a << 24);
}
a ^= c & 0xff;
a += (a << 1) + (a << 4) + (a << 7) + (a << 8) + (a << 24);
}
charCodeAt returns a number, but I'm thinking unicode only goes up to 2^16, right? So it seems like I wouldn't need to mask anything larger than 0xff00—saving two if/assignment blocks. (Of course the whole hashing part runs so quickly! So maybe that part won't matter.)
Well anyways, if somebody knows anything about implementing Bloom filter in actionscript that would be great.
