summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-09-10 22:50:39 +0200
committerTyge Løvset <[email protected]>2021-09-10 22:50:39 +0200
commit19b6ecf211c0c0212744992d991a340d6309311c (patch)
treec1495d7aa9a03b9e0936c55fd6ef4c84e71b4de3
parentad4c5377cf7e2f5812e2053e51550239fcd38d45 (diff)
downloadSTC-modified-19b6ecf211c0c0212744992d991a340d6309311c.tar.gz
STC-modified-19b6ecf211c0c0212744992d991a340d6309311c.zip
Added forward_cqueue() type pre-declaration support.
-rw-r--r--include/stc/forward.h2
-rw-r--r--include/stc/test_new_queue.c15
2 files changed, 15 insertions, 2 deletions
diff --git a/include/stc/forward.h b/include/stc/forward.h
index 78bc9173..5877d390 100644
--- a/include/stc/forward.h
+++ b/include/stc/forward.h
@@ -36,7 +36,7 @@
#define forward_csptr(TAG, VAL) _csptr_types(csptr_##TAG, VAL)
#define forward_cpque(TAG, VAL) _c_cpque_types(cpque_##TAG, VAL)
#define forward_cstack(TAG, VAL) _c_cstack_types(cstack_##TAG, VAL)
-//#define forward_cqueue(TAG, VAL) _c_cqueue_types(cqueue_##TAG, VAL)
+#define forward_cqueue(TAG, VAL) _c_cdeq_types(cqueue_##TAG, VAL)
#define forward_cvec(TAG, VAL) _c_cvec_types(cvec_##TAG, VAL)
#ifndef MAP_SIZE_T
diff --git a/include/stc/test_new_queue.c b/include/stc/test_new_queue.c
index fc8e3997..32084b22 100644
--- a/include/stc/test_new_queue.c
+++ b/include/stc/test_new_queue.c
@@ -1,12 +1,25 @@
#include <stc/crandom.h>
+#include <stc/forward.h>
#include <stdio.h>
+forward_cqueue(pnt, struct Point);
+
+struct Point { int x, y; } typedef Point;
+int point_compare(const Point* a, const Point* b) {
+ int c = c_default_compare(&a->x, &b->x);
+ return c ? c : c_default_compare(&a->y, &b->y);
+}
+#define f_tag pnt
+#define i_val Point
+#define i_cmp point_compare
+#include <stc/cqueue.h>
+
#define i_val int
#include <stc/cqueue.h>
#include <time.h>
int main() {
- int n = 8000000;
+ int n = 60000000;
stc64_t rng = stc64_init(time(NULL));
stc64_uniform_t dist = stc64_uniform_init(0, n);