Debugged multithreaded version. Now investigating some performance issues (not every thread is being used). This is an interesting version.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <cstring>
|
||||
#define min(A, B) ((A < B) ? (A) : (B))
|
||||
#define max(A, B) ((A > B) ? (A) : (B))
|
||||
#define better(GT, A, B) (GT ? max((A), (B)) : min((A), (B)))
|
||||
|
||||
template <class T> struct Array {
|
||||
T *data;
|
||||
@@ -18,6 +19,8 @@ template <class T> Array<T> make_array(int len) {
|
||||
.len=len
|
||||
};
|
||||
}
|
||||
template <class T> T back(Array<T> &a) { return a.data[a.len-1]; }
|
||||
template <class T> T front(Array<T> &a) { return a.data[0]; }
|
||||
|
||||
template <class T> struct DynArray {
|
||||
T* _data;
|
||||
@@ -48,6 +51,6 @@ template <class T> void append(DynArray<T> &a, T el) {
|
||||
a[a.end++] = el;
|
||||
}
|
||||
|
||||
template <class T> T& back(DynArray<T> &a) { return a._data[a.end-1]; }
|
||||
template <class T> T& front(DynArray<T> &a) { return a._data[0]; }
|
||||
template <class T> T back(DynArray<T> &a) { return a._data[a.end-1]; }
|
||||
template <class T> T front(DynArray<T> &a) { return a._data[0]; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user