[sledge] Return early for == args in Term compare and equal

Reviewed By: jvillard

Differential Revision: D21048931

fbshipit-source-id: 30e76278f
master
Josh Berdine 5 years ago committed by Facebook GitHub Bot
parent 76695690b8
commit fcd0e41ee6

@ -114,12 +114,16 @@ end = struct
non-coefficient, so Integer and Rational terms must compare higher than non-coefficient, so Integer and Rational terms must compare higher than
any valid monomial *) any valid monomial *)
let compare x y = let compare x y =
if x == y then 0
else
match (x, y) with match (x, y) with
| Var {id= i; name= _}, Var {id= j; name= _} when i > 0 && j > 0 -> | Var {id= i; name= _}, Var {id= j; name= _} when i > 0 && j > 0 ->
Int.compare i j Int.compare i j
| _ -> compare x y | _ -> compare x y
let equal x y = let equal x y =
x == y
||
match (x, y) with match (x, y) with
| Var {id= i; name= _}, Var {id= j; name= _} when i > 0 && j > 0 -> | Var {id= i; name= _}, Var {id= j; name= _} when i > 0 && j > 0 ->
Int.equal i j Int.equal i j

Loading…
Cancel
Save