File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed
Bloom Filter/BloomFilter.playground Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change 11//: Playground - noun: a place where people can play
2- // last checked with Xcode 9.0b4
3- #if swift(>=4.0)
4- print ( " Hello, Swift 4! " )
5- #endif
2+
63public class BloomFilter < T> {
74 fileprivate var array : [ Bool ]
85 private var hashFunctions : [ ( T ) -> Int ]
@@ -54,15 +51,15 @@ public class BloomFilter<T> {
5451
5552func djb2( x: String ) -> Int {
5653 var hash = 5381
57- for char in x. characters {
54+ for char in x {
5855 hash = ( ( hash << 5 ) &+ hash) &+ char. hashValue
5956 }
6057 return Int ( hash)
6158}
6259
6360func sdbm( x: String ) -> Int {
6461 var hash = 0
65- for char in x. characters {
62+ for char in x {
6663 hash = char. hashValue &+ ( hash << 6 ) &+ ( hash << 16 ) &- hash
6764 }
6865 return Int ( hash)
You can’t perform that action at this time.
0 commit comments