aboutsummaryrefslogtreecommitdiff
path: root/core/sort
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2019-09-01 20:02:39 +0100
committergingerBill <bill@gingerbill.org>2019-09-01 20:02:39 +0100
commit657103c4cff8f63cfa617d8c4371fd29df7b41a2 (patch)
treeb902045f4e9a88a0e92cac43a19939ac0741fb46 /core/sort
parentb9d3129fb3a4ba7ef49cea69d086a7f705819f2e (diff)
ThreadPool for the parser
Diffstat (limited to 'core/sort')
-rw-r--r--core/sort/sort.odin7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/sort/sort.odin b/core/sort/sort.odin
index 3c8366def..86953d7dd 100644
--- a/core/sort/sort.odin
+++ b/core/sort/sort.odin
@@ -1,6 +1,7 @@
package sort
import "core:mem"
+import "intrinsics"
bubble_sort_proc :: proc(array: $A/[]$T, f: proc(T, T) -> int) {
assert(f != nil);
@@ -26,7 +27,7 @@ bubble_sort_proc :: proc(array: $A/[]$T, f: proc(T, T) -> int) {
}
}
-bubble_sort :: proc(array: $A/[]$T) {
+bubble_sort :: proc(array: $A/[]$T) where intrinsics.type_is_ordered(T) {
count := len(array);
init_j, last_j := 0, count-1;
@@ -73,7 +74,7 @@ quick_sort_proc :: proc(array: $A/[]$T, f: proc(T, T) -> int) {
quick_sort_proc(a[i:n], f);
}
-quick_sort :: proc(array: $A/[]$T) {
+quick_sort :: proc(array: $A/[]$T) where intrinsics.type_is_ordered(T) {
a := array;
n := len(a);
if n < 2 do return;
@@ -146,7 +147,7 @@ merge_sort_proc :: proc(array: $A/[]$T, f: proc(T, T) -> int) {
if M & 1 == 0 do copy(arr2, arr1);
}
-merge_sort :: proc(array: $A/[]$T) {
+merge_sort :: proc(array: $A/[]$T) where intrinsics.type_is_ordered(T) {
merge_slices :: proc(arr1, arr2, out: A) {
N1, N2 := len(arr1), len(arr2);
i, j := 0, 0;