From 35439649c502897049530dad47633d8e9b3af8c6 Mon Sep 17 00:00:00 2001 From: Tyge Løvset <60263450+tylo-work@users.noreply.github.com> Date: Wed, 4 Mar 2020 17:48:42 +0100 Subject: Minors --- cdef.h | 1 + cmap_test.c | 7 ++++++- cvector.h | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cdef.h b/cdef.h index 8384778e..995d1ea3 100644 --- a/cdef.h +++ b/cdef.h @@ -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); } diff --git a/cvector.h b/cvector.h index a5f49f39..49f06c77 100644 --- a/cvector.h +++ b/cvector.h @@ -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) { \ -- cgit v1.2.3