diff options
| author | gingerBill <bill@gingerbill.org> | 2020-06-16 12:53:57 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-06-16 12:53:57 +0100 |
| commit | 5edb1e8a28115fce03760c1367bdb8c4fe935c46 (patch) | |
| tree | 9fb47316555f79fab85ae1bf7ea957ff09cb29eb /examples | |
| parent | f70939ab4f5efcb93c49cdef6a54429eb0ccb9fe (diff) | |
Add `hash.djb2` `hash.jenkins`; Add `container.Bloom_Filter`; Add `container.Ring`
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/demo/demo.odin | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/examples/demo/demo.odin b/examples/demo/demo.odin index 2485ca6f9..ea843dd72 100644 --- a/examples/demo/demo.odin +++ b/examples/demo/demo.odin @@ -7,6 +7,8 @@ import "core:thread" import "core:time" import "core:reflect" import "core:runtime" +import "core:container" +import "core:hash" import "intrinsics" @@ -1978,7 +1980,25 @@ pure_procedures :: proc() { } main :: proc() { - when true { + bloom := &container.Bloom_Filter{}; + + container.bloom_filter_init(bloom, 16); + defer container.bloom_filter_destroy(bloom); + container.bloom_filter_add_hash_proc(bloom, hash.djb2); + container.bloom_filter_add_hash_proc(bloom, hash.jenkins); + container.bloom_filter_add_hash_proc(bloom, hash.sdbm); + container.bloom_filter_add_hash_proc(bloom, hash.fnv32a); + + fmt.printf("Should be false: %v\n", container.bloom_filter_test_string(bloom, "hello world")); + container.bloom_filter_add_string(bloom, "hello world"); + fmt.printf("Should be true: %v\n", container.bloom_filter_test_string(bloom, "hello world")); + fmt.printf("Should probably be false: %v\n", container.bloom_filter_test_string(bloom, "world hello")); + fmt.println(bloom.bits); + + + fmt.println("Here"); + + when false { the_basics(); control_flow(); named_proc_return_parameters(); |