diff options
| author | Tyge Løvset <[email protected]> | 2020-03-04 17:48:42 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-03-04 17:48:42 +0100 |
| commit | 35439649c502897049530dad47633d8e9b3af8c6 (patch) | |
| tree | bce68fea835f65bc743b5d3b38135691846d3127 | |
| parent | 07c3e6d107e987d401f2c119c1ccc77699d32e9a (diff) | |
| download | STC-modified-35439649c502897049530dad47633d8e9b3af8c6.tar.gz STC-modified-35439649c502897049530dad47633d8e9b3af8c6.zip | |
Minors
| -rw-r--r-- | cdef.h | 1 | ||||
| -rw-r--r-- | cmap_test.c | 7 | ||||
| -rw-r--r-- | cvector.h | 4 |
3 files changed, 9 insertions, 3 deletions
@@ -16,6 +16,7 @@ // #define foo_1(X) foo_2(X, 100)
// #define foo_2(X, Y) X + Y
+#define _cdef_swap(T, x, y) { T __t = x; x = y; y = __t; }
#define cdef_initRaw(x) (x)
#define cdef_getRaw(x) (x)
diff --git a/cmap_test.c b/cmap_test.c index aec99192..8d33a6ac 100644 --- a/cmap_test.c +++ b/cmap_test.c @@ -97,7 +97,12 @@ int main() cmap_id_put(&mymap, i*i, i);
for (i = 1000; i < 1010; ++i)
- printf("look %d: %f\n", i*i, cmap_id_get(mymap, i*i)->value);
+ printf("lookup %d: %f\n", i*i, cmap_id_get(mymap, i*i)->value);
+
+ CMapEntry(id)* me = cmap_id_get(mymap, 10000);
+ printf("untouched: %d %f\n", me->untouched, me->value);
+ cmap_id_put(&mymap, 10000, 101.2);
+ printf("untouched: %d %f\n", me->untouched, me->value);
cmap_id_destroy(&mymap);
}
@@ -52,8 +52,8 @@ static inline CVector(tag) cvector_##tag##_init(void) { \ return cv; \
} \
\
-static inline void cvector_##tag##_swap(CVector(tag)* v1, CVector(tag)* v2) { \
- T* data = v1->data; v1->data = v2->data; v2->data = data; \
+static inline void cvector_##tag##_swap(CVector(tag)* a, CVector(tag)* b) { \
+ T* data = a->data; a->data = b->data; b->data = data; \
} \
\
static inline void cvector_##tag##_destroy(CVector(tag)* self) { \
|
