summaryrefslogtreecommitdiffhomepage
path: root/misc/examples
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-01-10 17:39:49 +0100
committerTyge Løvset <[email protected]>2023-01-10 17:39:49 +0100
commit74e95bc3261011ec65bd635ee6545733e85270ba (patch)
tree6a6c0343f10db742cabc45734d2057e7738144e1 /misc/examples
parentb3313ff01a8069592f63b18372fd0cf9e6c077bd (diff)
downloadSTC-modified-74e95bc3261011ec65bd635ee6545733e85270ba.tar.gz
STC-modified-74e95bc3261011ec65bd635ee6545733e85270ba.zip
Changed value type name of csort algo.
Diffstat (limited to 'misc/examples')
-rw-r--r--misc/examples/sort.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/misc/examples/sort.c b/misc/examples/sort.c
index 711ba7a6..af74ff51 100644
--- a/misc/examples/sort.c
+++ b/misc/examples/sort.c
@@ -3,24 +3,25 @@
#include <stdio.h>
#include <stc/crandom.h>
-typedef long long Elem;
-#define fmt_Elem "%lld"
#ifdef __cplusplus
#include <algorithm>
+ typedef long long csort_elm_value;
#else
- #define i_val Elem
+ #define i_tag elm
+ #define i_val long long
#include <stc/algo/csort.h>
#endif
+#define fmt_Elem "%lld"
-int testsort(Elem *a, size_t size, const char *desc) {
+int testsort(csort_elm_value *a, size_t size, const char *desc) {
clock_t t = clock();
#ifdef __cplusplus
printf("std::sort: ");
std::sort(a, a + size);
#else
printf("csort: ");
- csort_Elem(a, size);
+ csort_elm(a, size);
#endif
t = clock() - t;
@@ -31,7 +32,7 @@ int testsort(Elem *a, size_t size, const char *desc) {
int main(int argc, char *argv[]) {
size_t i, size = argc > 1 ? strtoull(argv[1], NULL, 0) : 10000000;
- Elem *a = (Elem*)malloc(sizeof(*a) * size);
+ csort_elm_value *a = (csort_elm_value*)malloc(sizeof(*a) * size);
if (a == NULL) return -1;
for (i = 0; i < size; i++)