Skip to content

Commit 8eb702a

Browse files
committed
Add fast path for two leafs
1 parent 415cd20 commit 8eb702a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

lib/elixir/lib/module/types/descr.ex

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5906,6 +5906,15 @@ defmodule Module.Types.Descr do
59065906
#
59075907
# ((U1 and not a2) or (D1 and not D2)) and not U2 and not D2
59085908
#
5909+
defp bdd_difference(bdd_leaf(_, _) = a1, bdd_leaf(_, _) = a2, leaf_compare) do
5910+
case leaf_compare.(a1, a2, :none) do
5911+
:disjoint -> a1
5912+
:subtype -> :bdd_bot
5913+
{:one_key_difference, a_diff, _} -> a_diff
5914+
:none -> bdd_difference(a1, a2)
5915+
end
5916+
end
5917+
59095918
defp bdd_difference(bdd1, bdd2, leaf_compare) when is_tuple(bdd1) and is_tuple(bdd2) do
59105919
{a1, c1, u1, d1} = bdd_expand(bdd1)
59115920
{a2, c2, u2, d2} = bdd_expand(bdd2)

0 commit comments

Comments
 (0)