ref: 067c3d093f3c6b6292e5eeeb0fe6e6ff75c5950c
parent: 516586152ab26883f5e57436634d9e5a715ff60a
author: qwx <qwx@sciops.net>
date: Thu Mar 17 03:02:39 EDT 2022
pheaps: return newly allocated heap
--- a/asif.h
+++ b/asif.h
@@ -69,7 +69,7 @@
void nukequeue(Pairheap**);
Pairheap* popqueue(Pairheap**);
void decreasekey(Pairheap*, double, Pairheap**);
-void pushqueue(double, void*, Pairheap**);
+Pairheap* pushqueue(double, void*, Pairheap**);
void four1(double*, int, int);
void realft(double*, int, int);
@@ -80,3 +80,5 @@
#define MIN(a,b) ((a) <= (b) ? (a) : (b))
#define MAX(a,b) ((a) >= (b) ? (a) : (b))
+
+#define SQRT2 1.4142135623730951
--- a/pheap.c
+++ b/pheap.c
@@ -70,7 +70,7 @@
}
}
-void
+Pairheap *
pushqueue(double n, void *aux, Pairheap **queue)
{
Pairheap *p;
@@ -79,4 +79,5 @@
p->n = n;
p->aux = aux;
*queue = mergequeue(p, *queue);
+ return p;
}