summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Gediminas Jakutis <gediminas@varciai.lt> 2021-03-14 03:16:02 +0200
committerGravatar Gediminas Jakutis <gediminas@varciai.lt> 2021-03-14 03:50:37 +0200
commit56f20e30636c16fd14205ba7c29cf8089caa1260 (patch)
tree24f948294d6a28a5ea47c983e1cade078357b3ef /src
parentc68444ff76eff88fbfa63a3ddbd6b9ce72337159 (diff)
downloadalgos-ld1-56f20e30636c16fd14205ba7c29cf8089caa1260.tar.gz
algos-ld1-56f20e30636c16fd14205ba7c29cf8089caa1260.tar.bz2
algos-ld1-56f20e30636c16fd14205ba7c29cf8089caa1260.zip
revert higher-than-64-bits support.
Too much hassle to actually pretty-print that crap out. Signed-off-by: Gediminas Jakutis <gediminas@varciai.lt>
Diffstat (limited to 'src')
-rw-r--r--src/defs.h31
-rw-r--r--src/mergesort.c2
-rw-r--r--src/util.h38
3 files changed, 1 insertions, 70 deletions
diff --git a/src/defs.h b/src/defs.h
index 878823f..90482bd 100644
--- a/src/defs.h
+++ b/src/defs.h
@@ -49,37 +49,6 @@
# else
typedef uint64_t field;
# endif
-
-/* 128 bit and up do not fit in basic types; building composites */
-
-#elif entry_field_size == 128
-# ifdef entry_field_signed
- typedef struct field {
- uint64_t low;
- int64_t high;
- } field;
-# else
- typedef struct field {
- uint64_t low;
- uint64_t high;
- } field;
-# endif
-#elif entry_field_size == 256
-# ifdef entry_field_signed
- typedef struct field {
- uint64_t low;
- uint64_t midlow;
- uint64_t midhigh;
- int64_t high;
- } field;
-# else
- typedef struct field {
- uint64_t low;
- uint64_t midlow;
- uint64_t midhigh;
- uint64_t high;
- } field;
-# endif
#endif
union nextoff {
diff --git a/src/mergesort.c b/src/mergesort.c
index aa05f8e..fb08d29 100644
--- a/src/mergesort.c
+++ b/src/mergesort.c
@@ -56,7 +56,7 @@ static int merge(struct stream * const dest, struct stream * const A, struct str
b = B->get(B, &b_store);
while (a || b) {
- if (a && (!b || is_less_equal(a_store.val, b_store.val))) {
+ if (a && (!b || a_store.val <= b_store.val)) {
dest->put(dest, a);
a = A->get(A, &a_store);
} else {
diff --git a/src/util.h b/src/util.h
index f2a84f9..9299f52 100644
--- a/src/util.h
+++ b/src/util.h
@@ -10,42 +10,4 @@
int stream_rewind(struct stream * const restrict in);
int split(struct stream * const src, struct stream * const A, struct stream * const B);
-/* inline crap below */
-
-static inline int is_less_equal(const field a, const field b) __attribute__((always_inline));
-
-static inline int is_less_equal(const field a, const field b)
-{
- int ret;
-
-/* all sizes fitting in a primitive type */
-#if entry_field_size <= 64
-
- ret = a <= b;
-
-/* composite of two 64bit */
-#elif entry_field_size == 128
-
- if (unlikely(a.high == b.high)) {
- ret = a.low <= b.low;
- } else {
- ret = a.high < b.high;
- }
-
-/* composite of four 64bit */
-#elif entry_field_size == 256
- if (likely(a.high != b.high)) {
- ret = a.high < b.high;
- } else if (likely(a.midhigh != b.midhigh)){
- ret = a.midhigh < b.midhigh;
- } else if (likely(a.midlow != b.midlow)){
- ret = a.midlow < b.midlow;
- } else {
- ret = a.low <= b.low;
- }
-#endif
-
- return ret;
-}
-
#endif /* ALGOS_UTIL_H_INCLUDED */