summaryrefslogtreecommitdiffhomepage
path: root/include/stc/algo
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-06-20 15:28:02 +0200
committerTyge Løvset <[email protected]>2023-06-20 15:28:02 +0200
commitde4f8fa86f141dfeab15f5576029910474f56fa1 (patch)
tree930f8ecb0a2765d4834aa34f6ac538096454816c /include/stc/algo
parentb617eded8cee98dd3ff9ac896328b172d37fcf91 (diff)
downloadSTC-modified-de4f8fa86f141dfeab15f5576029910474f56fa1.tar.gz
STC-modified-de4f8fa86f141dfeab15f5576029910474f56fa1.zip
Internal only:
Renamed _cx_memb() macro to _cx_MEMB() Renamed _cx_self macro to _cx_Self
Diffstat (limited to 'include/stc/algo')
-rw-r--r--include/stc/algo/sort.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/include/stc/algo/sort.h b/include/stc/algo/sort.h
index 2e73b0fb..291d90a6 100644
--- a/include/stc/algo/sort.h
+++ b/include/stc/algo/sort.h
@@ -52,12 +52,12 @@ int main() {
typedef i_val i_type;
#endif
#ifndef i_at
- #define i_at(arr, idx) _cx_memb(_at_mut)(arr, idx)
+ #define i_at(arr, idx) _cx_MEMB(_at_mut)(arr, idx)
#endif
#include "../priv/template.h"
-static inline void _cx_memb(_insertsort_ij)(_cx_self* arr, intptr_t lo, intptr_t hi) {
+static inline void _cx_MEMB(_insertsort_ij)(_cx_Self* arr, intptr_t lo, intptr_t hi) {
for (intptr_t j = lo, i = lo + 1; i <= hi; j = i, ++i) {
i_val key = *i_at(arr, i);
while (j >= 0 && (i_less((&key), i_at(arr, j)))) {
@@ -68,7 +68,7 @@ static inline void _cx_memb(_insertsort_ij)(_cx_self* arr, intptr_t lo, intptr_t
}
}
-static inline void _cx_memb(_sort_ij)(_cx_self* arr, intptr_t lo, intptr_t hi) {
+static inline void _cx_MEMB(_sort_ij)(_cx_Self* arr, intptr_t lo, intptr_t hi) {
intptr_t i = lo, j;
while (lo < hi) {
i_val pivot = *i_at(arr, lo + (hi - lo)*7/16);
@@ -87,14 +87,14 @@ static inline void _cx_memb(_sort_ij)(_cx_self* arr, intptr_t lo, intptr_t hi) {
c_swap(intptr_t, &hi, &j);
}
- if (j - lo > 64) _cx_memb(_sort_ij)(arr, lo, j);
- else if (j > lo) _cx_memb(_insertsort_ij)(arr, lo, j);
+ if (j - lo > 64) _cx_MEMB(_sort_ij)(arr, lo, j);
+ else if (j > lo) _cx_MEMB(_insertsort_ij)(arr, lo, j);
lo = i;
}
}
-static inline void _cx_memb(_sort_n)(_cx_self* arr, intptr_t len) {
- _cx_memb(_sort_ij)(arr, 0, len - 1);
+static inline void _cx_MEMB(_sort_n)(_cx_Self* arr, intptr_t len) {
+ _cx_MEMB(_sort_ij)(arr, 0, len - 1);
}
#include "../priv/template2.h"