feat(ds/enc): add bloom filter, FNV-1a and DJB2 hash units
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
- core.enc.fnv1a: FNV-1a 32/64-bit non-cryptographic hash with UnitTest - core.enc.djb2: DJB2 XOR/Add 32/64-bit hash variants with UnitTest - core.ds.bloom: probabilistic bloom filter (Bloom_New/Add/Test/Clear/Free) using double hashing (FNV-1a32 + DJB2_32) with UnitTest - core.ds.types: add TBloomFilter / PBloomFilter record - asuro.pas: wire all three UnitTests into boot test suite
This commit is contained in:
@@ -104,6 +104,9 @@ uses
|
|||||||
driver.storage.vfs,
|
driver.storage.vfs,
|
||||||
driver.video,
|
driver.video,
|
||||||
arch.x86.memory.virtual,
|
arch.x86.memory.virtual,
|
||||||
|
core.enc.fnv1a,
|
||||||
|
core.enc.djb2,
|
||||||
|
core.ds.bloom,
|
||||||
app.volcmd,
|
app.volcmd,
|
||||||
driver.storage.vol.mgr,
|
driver.storage.vol.mgr,
|
||||||
app.vterminal,
|
app.vterminal,
|
||||||
@@ -344,6 +347,9 @@ begin
|
|||||||
core.ds.prio.UnitTest;
|
core.ds.prio.UnitTest;
|
||||||
driver.storage.vfs.UnitTest;
|
driver.storage.vfs.UnitTest;
|
||||||
driver.storage.test.UnitTest;
|
driver.storage.test.UnitTest;
|
||||||
|
core.enc.fnv1a.UnitTest;
|
||||||
|
core.enc.djb2.UnitTest;
|
||||||
|
core.ds.bloom.UnitTest;
|
||||||
|
|
||||||
{ Initialize driver.video.desktop environment }
|
{ Initialize driver.video.desktop environment }
|
||||||
boot.splash.update(100, 'Booting desktop...');
|
boot.splash.update(100, 'Booting desktop...');
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -195,6 +195,32 @@ type
|
|||||||
IsMinHeap : boolean;
|
IsMinHeap : boolean;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ ------ Bloom Filter ------ }
|
||||||
|
|
||||||
|
{**
|
||||||
|
@abstract Pointer to a bloom filter.
|
||||||
|
**}
|
||||||
|
PBloomFilter = ^TBloomFilter;
|
||||||
|
|
||||||
|
{**
|
||||||
|
@abstract Probabilistic set-membership filter using double hashing.
|
||||||
|
@discussion The bit array is a flat kalloc'd byte buffer of
|
||||||
|
ceil(BitCount / 8) bytes. Membership tests use k independent
|
||||||
|
hash positions derived from two base hashes (FNV-1a + DJB2)
|
||||||
|
via double hashing: h_i(x) = (h1(x) + i * h2(x)) mod BitCount.
|
||||||
|
False positives are possible; false negatives are not.
|
||||||
|
@field Bits Pointer to the flat bit-array buffer.
|
||||||
|
@field BitCount Total number of bits in the filter (m).
|
||||||
|
@field HashCount Number of hash functions applied per element (k).
|
||||||
|
@field Count Number of elements inserted.
|
||||||
|
**}
|
||||||
|
TBloomFilter = record
|
||||||
|
Bits : void;
|
||||||
|
BitCount : uint32;
|
||||||
|
HashCount : uint32;
|
||||||
|
Count : uint32;
|
||||||
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
end.
|
end.
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user