"git@developer.sourcefind.cn:tianlh/lightgbm-dcu.git" did not exist on "5ea005790e3f0eedeb75574d63abd911c158e2ef"
Unverified Commit 0d3e2046 authored by Ilya Matiach's avatar Ilya Matiach Committed by GitHub
Browse files

[SWIG][mmlspark] allow allocating more than int max array (#2859)

parent 995a5974
...@@ -233,11 +233,6 @@ ...@@ -233,11 +233,6 @@
%pointer_cast(int32_t *, void *, int32_t_to_voidp_ptr) %pointer_cast(int32_t *, void *, int32_t_to_voidp_ptr)
%pointer_cast(int64_t *, void *, int64_t_to_voidp_ptr) %pointer_cast(int64_t *, void *, int64_t_to_voidp_ptr)
%array_functions(double, doubleArray)
%array_functions(float, floatArray)
%array_functions(int, intArray)
%array_functions(long, longArray)
/* Custom pointer manipulation template */ /* Custom pointer manipulation template */
%define %pointer_manipulation(TYPE, NAME) %define %pointer_manipulation(TYPE, NAME)
%{ %{
...@@ -278,6 +273,36 @@ TYPE *NAME##_handle(); ...@@ -278,6 +273,36 @@ TYPE *NAME##_handle();
%enddef %enddef
%define %long_array_functions(TYPE,NAME)
%{
static TYPE *new_##NAME(int64_t nelements) { %}
%{ return new TYPE[nelements](); %}
%{}
static void delete_##NAME(TYPE *ary) { %}
%{ delete [] ary; %}
%{}
static TYPE NAME##_getitem(TYPE *ary, int64_t index) {
return ary[index];
}
static void NAME##_setitem(TYPE *ary, int64_t index, TYPE value) {
ary[index] = value;
}
%}
TYPE *new_##NAME(int64_t nelements);
void delete_##NAME(TYPE *ary);
TYPE NAME##_getitem(TYPE *ary, int64_t index);
void NAME##_setitem(TYPE *ary, int64_t index, TYPE value);
%enddef
%long_array_functions(double, doubleArray)
%long_array_functions(float, floatArray)
%long_array_functions(int, intArray)
%long_array_functions(long, longArray)
%pointer_manipulation(void*, voidpp) %pointer_manipulation(void*, voidpp)
/* Allow dereferencing of void** to void* */ /* Allow dereferencing of void** to void* */
......
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