Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marian-nmt/intgemm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Heafield <github@kheafield.com>2018-06-17 19:47:37 +0300
committerKenneth Heafield <github@kheafield.com>2018-06-17 19:47:37 +0300
commitbc1ab9d4a360cd2078d067cca9fdb6fedf78158e (patch)
tree829f7d6cb0cc88bd3bb69d34e18533902998deb3 /aligned.h
parentf5b4beb0012758e7619f73228782ac94fc53aa92 (diff)
Reworked benchmark
Diffstat (limited to 'aligned.h')
-rw-r--r--aligned.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/aligned.h b/aligned.h
index 44889d1..83915a1 100644
--- a/aligned.h
+++ b/aligned.h
@@ -19,4 +19,17 @@ template <class T> T* AlignedArray(std::size_t size) {
return static_cast<T*>(aligned_alloc(64, size * sizeof(T)));
}
+template <class T> class AlignedVector {
+ public:
+ explicit AlignedVector(std::size_t size) : mem_(AlignedArray<T>(size)) {}
+
+ T &operator[](std::size_t offset) { return mem_.get()[offset]; }
+ const T &operator[](std::size_t offset) const { return mem_.get()[offset]; }
+
+ T *get() { return mem_.get(); }
+ const T *get() const { return mem_.get(); }
+ private:
+ free_ptr<T> mem_;
+};
+
} // namespace intgemm