diff options
| author | Simon Tatham <anakin@pobox.com> | 2023-04-20 15:32:10 +0100 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2023-04-20 18:39:35 +0100 |
| commit | 14e1e05510ac02a5502823bafe46d98c6fab3e5c (patch) | |
| tree | d7e99ac9bb574bc62a324cf3bb435b485c1113b3 /dsf.c | |
| parent | 088fdeee38599b1711ba8766d36c652f1355e36e (diff) | |
| download | puzzles-14e1e05510ac02a5502823bafe46d98c6fab3e5c.zip puzzles-14e1e05510ac02a5502823bafe46d98c6fab3e5c.tar.gz puzzles-14e1e05510ac02a5502823bafe46d98c6fab3e5c.tar.bz2 puzzles-14e1e05510ac02a5502823bafe46d98c6fab3e5c.tar.xz | |
Introduce a new dsf_equivalent() function.
Not very interesting, but the idiom for checking equivalence via two
calls to dsf_canonify is cumbersome enough to be worth abbreviating.
Diffstat (limited to 'dsf.c')
| -rw-r--r-- | dsf.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -58,6 +58,11 @@ int dsf_canonify(DSF *dsf, int index) return edsf_canonify(dsf, index, NULL); } +bool dsf_equivalent(DSF *dsf, int i1, int i2) +{ + return edsf_canonify(dsf, i1, NULL) == edsf_canonify(dsf, i2, NULL); +} + void dsf_merge(DSF *dsf, int v1, int v2) { edsf_merge(dsf, v1, v2, false); |