File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -64,18 +64,21 @@ private def mkIdx {sz : Nat} (hash : UInt64) (h : sz.isPowerOfTwo) : { u : USize
64
64
65
65
def findEntry? [BEq α] [Hashable α] (m : HashMapImp α β) (a : α) : Option (α × β) :=
66
66
match m with
67
+ | ⟨0 , _⟩ => none
67
68
| ⟨_, buckets⟩ =>
68
69
let ⟨i, h⟩ := mkIdx (hash a) buckets.property
69
70
buckets.val[i].findEntry? a
70
71
71
72
def find? [beq : BEq α] [Hashable α] (m : HashMapImp α β) (a : α) : Option β :=
72
73
match m with
74
+ | ⟨0 , _⟩ => none
73
75
| ⟨_, buckets⟩ =>
74
76
let ⟨i, h⟩ := mkIdx (hash a) buckets.property
75
77
buckets.val[i].find? a
76
78
77
79
def contains [BEq α] [Hashable α] (m : HashMapImp α β) (a : α) : Bool :=
78
80
match m with
81
+ | ⟨0 , _⟩ => false
79
82
| ⟨_, buckets⟩ =>
80
83
let ⟨i, h⟩ := mkIdx (hash a) buckets.property
81
84
buckets.val[i].contains a
Original file line number Diff line number Diff line change @@ -60,12 +60,14 @@ private def mkIdx {sz : Nat} (hash : UInt64) (h : sz.isPowerOfTwo) : { u : USize
60
60
61
61
def find? [BEq α] [Hashable α] (m : HashSetImp α) (a : α) : Option α :=
62
62
match m with
63
+ | ⟨0 , _⟩ => none
63
64
| ⟨_, buckets⟩ =>
64
65
let ⟨i, h⟩ := mkIdx (hash a) buckets.property
65
66
buckets.val[i].find? (fun a' => a == a')
66
67
67
68
def contains [BEq α] [Hashable α] (m : HashSetImp α) (a : α) : Bool :=
68
69
match m with
70
+ | ⟨0 , _⟩ => false
69
71
| ⟨_, buckets⟩ =>
70
72
let ⟨i, h⟩ := mkIdx (hash a) buckets.property
71
73
buckets.val[i].contains a
You can’t perform that action at this time.
0 commit comments