diff options
| -rw-r--r-- | stc/cvec.h | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -71,6 +71,8 @@ STC_API void \ cvec_##tag##_sort_with(cvec_##tag* self, int(*cmp)(const Value*, const Value*)); \
STC_API size_t \
cvec_##tag##_find(const cvec_##tag* self, RawValue rawValue); \
+STC_API int \
+cvec_##tag##_value_compare(const Value* x, const Value* y); \
\
STC_INLINE cvec_##tag \
cvec_##tag##_init(void) { \
@@ -107,6 +109,14 @@ STC_INLINE void \ cvec_##tag##_swap(cvec_##tag* a, cvec_##tag* b) { \
c_swap(Value*, a->data, b->data); \
} \
+STC_INLINE void \
+cvec_##tag##_sort(cvec_##tag* self) { \
+ qsort(self->data, cvec_size(*self), sizeof(Value), (_cvec_cmp) cvec_##tag##_value_compare); \
+} \
+STC_INLINE void \
+cvec_##tag##_sort_with(cvec_##tag* self, int(*cmp)(const Value*, const Value*)) { \
+ qsort(self->data, cvec_size(*self), sizeof(Value), (_cvec_cmp) cmp); \
+} \
\
typedef struct { \
Value *item, *end; \
@@ -208,14 +218,6 @@ cvec_##tag##_value_compare(const Value* x, const Value* y) { \ RawValue rx = valueToRaw(x); \
RawValue ry = valueToRaw(y); \
return valueCompareRaw(&rx, &ry); \
-} \
-STC_API void \
-cvec_##tag##_sort(cvec_##tag* self) { \
- qsort(self->data, cvec_size(*self), sizeof(Value), (_cvec_cmp) cvec_##tag##_value_compare); \
-} \
-STC_API void \
-cvec_##tag##_sort_with(cvec_##tag* self, int(*cmp)(const Value*, const Value*)) { \
- qsort(self->data, cvec_size(*self), sizeof(Value), (_cvec_cmp) cmp); \
}
#else
@@ -244,5 +246,4 @@ STC_INLINE size_t _cvec_safe_capacity(const void* data) { return data ? ((const size_t *) data)[-1] : 0;
}
-
#endif
|
