Port R compatibility patches from 1.0.0 release branch (#5577)

* Don't use memset to set struct when compiling for R

* Support 32-bit Solaris target for R package
This commit is contained in:
Philip Hyunsu Cho
2020-04-21 22:51:18 -07:00
committed by GitHub
parent f27b6f9ba6
commit e4f5b6c84f
4 changed files with 15 additions and 9 deletions

View File

@@ -831,7 +831,11 @@ void GHistIndexBlockMatrix::Init(const GHistIndexMatrix& gmat,
* \brief fill a histogram by zeros in range [begin, end)
*/
void InitilizeHistByZeroes(GHistRow hist, size_t begin, size_t end) {
#if defined(XGBOOST_STRICT_R_MODE) && XGBOOST_STRICT_R_MODE == 1
std::fill(hist.begin() + begin, hist.begin() + end, tree::GradStats());
#else // defined(XGBOOST_STRICT_R_MODE) && XGBOOST_STRICT_R_MODE == 1
memset(hist.data() + begin, '\0', (end-begin)*sizeof(tree::GradStats));
#endif // defined(XGBOOST_STRICT_R_MODE) && XGBOOST_STRICT_R_MODE == 1
}
/*!