summaryrefslogtreecommitdiff
path: root/lib/queue.c
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2017-11-02 11:02:07 -0400
committerJaron Kent-Dobias <jaron@kent-dobias.com>2017-11-02 11:02:07 -0400
commit30534606d5690e176d168f640f55162fa15f0a19 (patch)
tree30a982262f062bd92a467b2b21b2142dbd90df97 /lib/queue.c
parenta0db32c0ad05fbe2753d44b1e82f608d99bd9742 (diff)
downloadc++-30534606d5690e176d168f640f55162fa15f0a19.tar.gz
c++-30534606d5690e176d168f640f55162fa15f0a19.tar.bz2
c++-30534606d5690e176d168f640f55162fa15f0a19.zip
major changes (again) to the measurement of autocorrelation
Diffstat (limited to 'lib/queue.c')
-rw-r--r--lib/queue.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/queue.c b/lib/queue.c
index aebbb2a..0823518 100644
--- a/lib/queue.c
+++ b/lib/queue.c
@@ -9,6 +9,14 @@ void stack_push(ll_t **q, uint32_t x) {
*q = nq;
}
+void stack_push_d(dll_t **q, double x) {
+ dll_t *nq = malloc(sizeof(dll_t));
+ nq->x = x;
+ nq->next = *q;
+
+ *q = nq;
+}
+
uint32_t stack_pop(ll_t **q) {
ll_t *old_q = *q;
@@ -20,6 +28,17 @@ uint32_t stack_pop(ll_t **q) {
return x;
}
+double stack_pop_d(dll_t **q) {
+ dll_t *old_q = *q;
+
+ *q = old_q->next;
+ double x = old_q->x;
+
+ free(old_q);
+
+ return x;
+}
+
bool stack_contains(const ll_t *q, uint32_t x) {
if (q == NULL) {
return false;