Skip to content

Commit 4201fb4

Browse files
committed
Update for Swift 4.2.
* Remove the top code snippet, as per instructions. * Remove use of deprecated `characters` property.
1 parent 6ef7a6e commit 4201fb4

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

Diff for: Bloom Filter/BloomFilter.playground/Contents.swift

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
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+
63
public class BloomFilter<T> {
74
fileprivate var array: [Bool]
85
private var hashFunctions: [(T) -> Int]
@@ -54,15 +51,15 @@ public class BloomFilter<T> {
5451

5552
func 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

6360
func 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)

0 commit comments

Comments
 (0)