Skip to content

Commit

Permalink
removed warnings about types in comparison ([-Wsign-compare]) (#1953)
Browse files Browse the repository at this point in the history
* removed comparison warning

* fixed spacing
  • Loading branch information
StrikerRUS authored and guolinke committed Jan 18, 2019
1 parent 99f8e3e commit e220f8a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/io/dataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ std::vector<std::vector<int>> FastFeatureBundling(std::vector<std::unique_ptr<Bi
// sort by non zero cnt
std::vector<int> sorted_idx;
sorted_idx.reserve(used_features.size());
for (int i = 0; i < used_features.size(); ++i) {
for (int i = 0; i < static_cast<int>(used_features.size()); ++i) {
sorted_idx.emplace_back(i);
}
// sort by non zero cnt, bigger first
Expand Down
4 changes: 2 additions & 2 deletions src/io/dataset_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ Dataset* DatasetLoader::LoadFromBinFile(const char* data_filename, const char* b
mem_ptr += sizeof(int) * (dataset->num_groups_);

if(!config_.monotone_constraints.empty()) {
CHECK(dataset->num_total_features_ == config_.monotone_constraints.size());
CHECK(static_cast<size_t>(dataset->num_total_features_) == config_.monotone_constraints.size());
dataset->monotone_types_.resize(dataset->num_features_);
for(int i = 0; i < dataset->num_total_features_; ++i){
int inner_fidx = dataset->InnerFeatureIndex(i);
Expand All @@ -394,7 +394,7 @@ Dataset* DatasetLoader::LoadFromBinFile(const char* data_filename, const char* b
}

if(!config_.feature_contri.empty()) {
CHECK(dataset->num_total_features_ == config_.feature_contri.size());
CHECK(static_cast<size_t>(dataset->num_total_features_) == config_.feature_contri.size());
dataset->feature_penalty_.resize(dataset->num_features_);
for(int i = 0; i < dataset->num_total_features_; ++i){
int inner_fidx = dataset->InnerFeatureIndex(i);
Expand Down
2 changes: 1 addition & 1 deletion src/metric/dcg_calculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void DCGCalculator::DefaultLabelGain(std::vector<double>* label_gain) {

void DCGCalculator::Init(const std::vector<double>& input_label_gain) {
label_gain_.resize(input_label_gain.size());
for(size_t i = 0;i < input_label_gain.size();++i){
for (size_t i = 0; i < input_label_gain.size(); ++i) {
label_gain_[i] = static_cast<double>(input_label_gain[i]);
}
discount_.resize(kMaxPosition);
Expand Down

0 comments on commit e220f8a

Please sign in to comment.