Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
5c399840
Unverified
Commit
5c399840
authored
Jan 30, 2019
by
Guolin Ke
Committed by
GitHub
Jan 30, 2019
Browse files
fix R's overflow (#1960)
parent
a2f5c50c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
include/LightGBM/R_object_helper.h
include/LightGBM/R_object_helper.h
+4
-0
src/lightgbm_R.cpp
src/lightgbm_R.cpp
+1
-1
No files found.
include/LightGBM/R_object_helper.h
View file @
5c399840
...
@@ -124,10 +124,14 @@ typedef union { VECTOR_SER s; double align; } SEXPREC_ALIGN;
...
@@ -124,10 +124,14 @@ typedef union { VECTOR_SER s; double align; } SEXPREC_ALIGN;
#define R_INT_PTR(x) ((int *) DATAPTR(x))
#define R_INT_PTR(x) ((int *) DATAPTR(x))
#define R_INT64_PTR(x) ((int64_t *) DATAPTR(x))
#define R_REAL_PTR(x) ((double *) DATAPTR(x))
#define R_REAL_PTR(x) ((double *) DATAPTR(x))
#define R_AS_INT(x) (*((int *) DATAPTR(x)))
#define R_AS_INT(x) (*((int *) DATAPTR(x)))
#define R_AS_INT64(x) (*((int64_t *) DATAPTR(x)))
#define R_IS_NULL(x) ((*(LGBM_SE)(x)).sxpinfo.type == 0)
#define R_IS_NULL(x) ((*(LGBM_SE)(x)).sxpinfo.type == 0)
// 64bit pointer
// 64bit pointer
...
...
src/lightgbm_R.cpp
View file @
5c399840
...
@@ -474,7 +474,7 @@ LGBM_SE LGBM_BoosterGetNumPredict_R(LGBM_SE handle,
...
@@ -474,7 +474,7 @@ LGBM_SE LGBM_BoosterGetNumPredict_R(LGBM_SE handle,
R_API_BEGIN
();
R_API_BEGIN
();
int64_t
len
;
int64_t
len
;
CHECK_CALL
(
LGBM_BoosterGetNumPredict
(
R_GET_PTR
(
handle
),
R_AS_INT
(
data_idx
),
&
len
));
CHECK_CALL
(
LGBM_BoosterGetNumPredict
(
R_GET_PTR
(
handle
),
R_AS_INT
(
data_idx
),
&
len
));
R_INT_PTR
(
out
)[
0
]
=
static_cast
<
int
>
(
len
)
;
R_INT
64
_PTR
(
out
)[
0
]
=
len
;
R_API_END
();
R_API_END
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment