We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6ef7a6e commit 4201fb4Copy full SHA for 4201fb4
Bloom Filter/BloomFilter.playground/Contents.swift
@@ -1,8 +1,5 @@
1
//: 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
+
6
public class BloomFilter<T> {
7
fileprivate var array: [Bool]
8
private var hashFunctions: [(T) -> Int]
@@ -54,15 +51,15 @@ public class BloomFilter<T> {
54
51
55
52
func djb2(x: String) -> Int {
56
53
var hash = 5381
57
- for char in x.characters {
+ for char in x {
58
hash = ((hash << 5) &+ hash) &+ char.hashValue
59
}
60
return Int(hash)
61
62
63
func sdbm(x: String) -> Int {
64
var hash = 0
65
66
hash = char.hashValue &+ (hash << 6) &+ (hash << 16) &- hash
67
68
0 commit comments