aboutsummaryrefslogtreecommitdiffstats
path: root/native/jni/src/utils/int_array_view.h
diff options
context:
space:
mode:
authorKeisuke Kuroyanagi <ksk@google.com>2014-09-11 15:21:52 +0900
committerKeisuke Kuroyanagi <ksk@google.com>2014-09-11 15:21:52 +0900
commita3b0eb168567c2650b024366f95f6b9b0ff1c811 (patch)
tree9e6299c9fdc763bbb26e778a72d848d08e0a812b /native/jni/src/utils/int_array_view.h
parent4634b75d3474aed6f1c69c283b36a18c261c53b5 (diff)
downloadlatinime-a3b0eb168567c2650b024366f95f6b9b0ff1c811.tar.gz
latinime-a3b0eb168567c2650b024366f95f6b9b0ff1c811.tar.xz
latinime-a3b0eb168567c2650b024366f95f6b9b0ff1c811.zip
Implement IntArrayView.copyToBuffer().
Bug: 14425059 Change-Id: Ic1b7de72701eae0c0b1bb28d12514099446a66a9
Diffstat (limited to 'native/jni/src/utils/int_array_view.h')
-rw-r--r--native/jni/src/utils/int_array_view.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/native/jni/src/utils/int_array_view.h b/native/jni/src/utils/int_array_view.h
index 08256bdef..c39add9fe 100644
--- a/native/jni/src/utils/int_array_view.h
+++ b/native/jni/src/utils/int_array_view.h
@@ -17,8 +17,9 @@
#ifndef LATINIME_INT_ARRAY_VIEW_H
#define LATINIME_INT_ARRAY_VIEW_H
+#include <array>
#include <cstdint>
-#include <cstdlib>
+#include <cstring>
#include <vector>
#include "defines.h"
@@ -103,6 +104,12 @@ class IntArrayView {
return IntArrayView(mPtr + n, mSize - n);
}
+ template <size_t N>
+ void copyToArray(std::array<int, N> *const buffer, const size_t offset) const {
+ ASSERT(mSize + offset <= N);
+ memmove(buffer->data() + offset, mPtr, sizeof(int) * mSize);
+ }
+
private:
DISALLOW_ASSIGNMENT_OPERATOR(IntArrayView);