shithub: puzzles

Download patch

ref: b7356cd209eb6a0b8bb153e34a9c1a5831884c7b
parent: b9547673c6462bf73e642328300479df6df71d7b
author: Simon Tatham <[email protected]>
date: Sun Oct 29 04:34:09 EST 2006

r6880 accidentally backed out r6780. That's what I get for accepting
source files from Mike rather than patches, and not adequately
checking the result...

[originally from svn r6882]
[r6780 == f05c25347d66821d928668a7e87dffbf3ffed027]
[r6880 == b9547673c6462bf73e642328300479df6df71d7b]

--- a/dsf.c
+++ b/dsf.c
@@ -60,17 +60,23 @@
     sfree(inverse_elements);
 }
 
-int *snew_dsf(int size)
+void dsf_init(int *dsf, int size)
 {
     int i;
-    int *ret;
-    
-    ret = snewn(size, int);
+
     for (i = 0; i < size; i++) {
         /* Bottom bit of each element of this array stores whether that element
          * is opposite to its parent, which starts off as false */
-        ret[i] = i << 1; 
+        dsf[i] = i << 1;
     }
+}
+
+int *snew_dsf(int size)
+{
+    int *ret;
+    
+    ret = snewn(size, int);
+    dsf_init(ret, size);
 
     /*print_dsf(ret, size); */