"vscode:/vscode.git/clone" did not exist on "d557118b370cb2732402f5943db029b6c8a14dd7"
Commit cc62b1c3 authored by Guolin Ke's avatar Guolin Ke
Browse files

use std::memcpy to copy array.

parent 516e66a5
...@@ -1140,9 +1140,7 @@ LIGHTGBM_C_EXPORT int LGBM_AllocateArray(int64_t len, int type, ArrayHandle* out ...@@ -1140,9 +1140,7 @@ LIGHTGBM_C_EXPORT int LGBM_AllocateArray(int64_t len, int type, ArrayHandle* out
template<typename T> template<typename T>
void Copy(T* dst, const T* src, int64_t len) { void Copy(T* dst, const T* src, int64_t len) {
for (int64_t i = 0; i < len; ++i) { std::memcpy(dst, src, sizeof(T) * len);
dst[i] = src[i];
}
} }
LIGHTGBM_C_EXPORT int LGBM_CopyToArray(ArrayHandle arr, int type, int64_t start_idx, const void* src, int64_t len) { LIGHTGBM_C_EXPORT int LGBM_CopyToArray(ArrayHandle arr, int type, int64_t start_idx, const void* src, int64_t len) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment