Commit 54b04405 authored by Guolin Ke's avatar Guolin Ke
Browse files

fix #886

parent 3cce5ee1
...@@ -72,10 +72,9 @@ public: ...@@ -72,10 +72,9 @@ public:
buffer += sizeof(right_sum_hessian); buffer += sizeof(right_sum_hessian);
std::memcpy(buffer, &default_left, sizeof(default_left)); std::memcpy(buffer, &default_left, sizeof(default_left));
buffer += sizeof(default_left); buffer += sizeof(default_left);
for (int i = 0; i < num_cat_threshold; ++i) { std::memcpy(buffer, &num_cat_threshold, sizeof(num_cat_threshold));
std::memcpy(buffer, &cat_threshold[i], sizeof(uint32_t)); buffer += sizeof(num_cat_threshold);
buffer += sizeof(uint32_t); std::memcpy(buffer, cat_threshold.data(), sizeof(uint32_t) * num_cat_threshold);
}
} }
void CopyFrom(const char* buffer) { void CopyFrom(const char* buffer) {
...@@ -103,11 +102,10 @@ public: ...@@ -103,11 +102,10 @@ public:
buffer += sizeof(right_sum_hessian); buffer += sizeof(right_sum_hessian);
std::memcpy(&default_left, buffer, sizeof(default_left)); std::memcpy(&default_left, buffer, sizeof(default_left));
buffer += sizeof(default_left); buffer += sizeof(default_left);
std::memcpy(&num_cat_threshold, buffer, sizeof(num_cat_threshold));
buffer += sizeof(num_cat_threshold);
cat_threshold.resize(num_cat_threshold); cat_threshold.resize(num_cat_threshold);
for (int i = 0; i < num_cat_threshold; ++i) { std::memcpy(cat_threshold.data(), buffer, sizeof(uint32_t) * num_cat_threshold);
std::memcpy(&cat_threshold[i], buffer, sizeof(uint32_t));
buffer += sizeof(uint32_t);
}
} }
inline void Reset() { inline void Reset() {
......
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