Skip to content

Commit

Permalink
fix #886
Browse files Browse the repository at this point in the history
  • Loading branch information
guolinke committed Sep 10, 2017
1 parent 3cce5ee commit 54b0440
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/treelearner/split_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,9 @@ struct SplitInfo {
buffer += sizeof(right_sum_hessian);
std::memcpy(buffer, &default_left, sizeof(default_left));
buffer += sizeof(default_left);
for (int i = 0; i < num_cat_threshold; ++i) {
std::memcpy(buffer, &cat_threshold[i], sizeof(uint32_t));
buffer += sizeof(uint32_t);
}
std::memcpy(buffer, &num_cat_threshold, sizeof(num_cat_threshold));
buffer += sizeof(num_cat_threshold);
std::memcpy(buffer, cat_threshold.data(), sizeof(uint32_t) * num_cat_threshold);
}

void CopyFrom(const char* buffer) {
Expand Down Expand Up @@ -103,11 +102,10 @@ struct SplitInfo {
buffer += sizeof(right_sum_hessian);
std::memcpy(&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);
for (int i = 0; i < num_cat_threshold; ++i) {
std::memcpy(&cat_threshold[i], buffer, sizeof(uint32_t));
buffer += sizeof(uint32_t);
}
std::memcpy(cat_threshold.data(), buffer, sizeof(uint32_t) * num_cat_threshold);
}

inline void Reset() {
Expand Down

0 comments on commit 54b0440

Please sign in to comment.