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
6464
6565def findEntry? [BEq α] [Hashable α] (m : HashMapImp α β) (a : α) : Option (α × β) :=
6666 match m with
67+ | ⟨0 , _⟩ => none
6768 | ⟨_, buckets⟩ =>
6869 let ⟨i, h⟩ := mkIdx (hash a) buckets.property
6970 buckets.val[i].findEntry? a
7071
7172def find? [beq : BEq α] [Hashable α] (m : HashMapImp α β) (a : α) : Option β :=
7273 match m with
74+ | ⟨0 , _⟩ => none
7375 | ⟨_, buckets⟩ =>
7476 let ⟨i, h⟩ := mkIdx (hash a) buckets.property
7577 buckets.val[i].find? a
7678
7779def contains [BEq α] [Hashable α] (m : HashMapImp α β) (a : α) : Bool :=
7880 match m with
81+ | ⟨0 , _⟩ => false
7982 | ⟨_, buckets⟩ =>
8083 let ⟨i, h⟩ := mkIdx (hash a) buckets.property
8184 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
6060
6161def find? [BEq α] [Hashable α] (m : HashSetImp α) (a : α) : Option α :=
6262 match m with
63+ | ⟨0 , _⟩ => none
6364 | ⟨_, buckets⟩ =>
6465 let ⟨i, h⟩ := mkIdx (hash a) buckets.property
6566 buckets.val[i].find? (fun a' => a == a')
6667
6768def contains [BEq α] [Hashable α] (m : HashSetImp α) (a : α) : Bool :=
6869 match m with
70+ | ⟨0 , _⟩ => false
6971 | ⟨_, buckets⟩ =>
7072 let ⟨i, h⟩ := mkIdx (hash a) buckets.property
7173 buckets.val[i].contains a
You can’t perform that action at this time.
0 commit comments