Skip to content

Commit

Permalink
cast1
Browse files Browse the repository at this point in the history
  • Loading branch information
abd-770 committed Sep 4, 2024
1 parent 325f198 commit 783443a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
20 changes: 10 additions & 10 deletions internal/core/src/indexbuilder/index_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ NewBuildIndexInfo(CBuildIndexInfo* c_build_index_info,

void
DeleteBuildIndexInfo(CBuildIndexInfo c_build_index_info) {
auto info = (BuildIndexInfo*)c_build_index_info;
auto info = static_cast<BuildIndexInfo*>(c_build_index_info);
delete info;
}

Expand All @@ -516,7 +516,7 @@ AppendBuildIndexParam(CBuildIndexInfo c_build_index_info,
const uint8_t* serialized_index_params,
const uint64_t len) {
try {
auto build_index_info = (BuildIndexInfo*)c_build_index_info;
auto build_index_info = static_cast<BuildIndexInfo*>(c_build_index_info);
auto index_params =
std::make_unique<milvus::proto::indexcgo::IndexParams>();
auto res = index_params->ParseFromArray(serialized_index_params, len);
Expand All @@ -543,7 +543,7 @@ AppendBuildTypeParam(CBuildIndexInfo c_build_index_info,
const uint8_t* serialized_type_params,
const uint64_t len) {
try {
auto build_index_info = (BuildIndexInfo*)c_build_index_info;
auto build_index_info = static_cast<BuildIndexInfo*>(c_build_index_info);
auto type_params =
std::make_unique<milvus::proto::indexcgo::TypeParams>();
auto res = type_params->ParseFromArray(serialized_type_params, len);
Expand Down Expand Up @@ -575,7 +575,7 @@ AppendFieldMetaInfoV2(CBuildIndexInfo c_build_index_info,
enum CDataType field_type,
int64_t dim) {
try {
auto build_index_info = (BuildIndexInfo*)c_build_index_info;
auto build_index_info = static_cast<BuildIndexInfo*>(c_build_index_info);
build_index_info->collection_id = collection_id;
build_index_info->partition_id = partition_id;
build_index_info->segment_id = segment_id;
Expand All @@ -598,7 +598,7 @@ AppendFieldMetaInfo(CBuildIndexInfo c_build_index_info,
int64_t field_id,
enum CDataType field_type) {
try {
auto build_index_info = (BuildIndexInfo*)c_build_index_info;
auto build_index_info = static_cast<BuildIndexInfo*>(c_build_index_info);
build_index_info->collection_id = collection_id;
build_index_info->partition_id = partition_id;
build_index_info->segment_id = segment_id;
Expand All @@ -624,7 +624,7 @@ AppendIndexMetaInfo(CBuildIndexInfo c_build_index_info,
int64_t build_id,
int64_t version) {
try {
auto build_index_info = (BuildIndexInfo*)c_build_index_info;
auto build_index_info = static_cast<BuildIndexInfo*>(c_build_index_info);
build_index_info->index_id = index_id;
build_index_info->index_build_id = build_id;
build_index_info->index_version = version;
Expand All @@ -645,7 +645,7 @@ CStatus
AppendInsertFilePath(CBuildIndexInfo c_build_index_info,
const char* c_file_path) {
try {
auto build_index_info = (BuildIndexInfo*)c_build_index_info;
auto build_index_info = static_cast<BuildIndexInfo*>(c_build_index_info);
std::string insert_file_path(c_file_path);
build_index_info->insert_files.emplace_back(insert_file_path);

Expand All @@ -662,7 +662,7 @@ CStatus
AppendIndexEngineVersionToBuildInfo(CBuildIndexInfo c_load_index_info,
int32_t index_engine_version) {
try {
auto build_index_info = (BuildIndexInfo*)c_load_index_info;
auto build_index_info = static_cast<BuildIndexInfo*>(c_load_index_info);
build_index_info->index_engine_version = index_engine_version;

auto status = CStatus();
Expand All @@ -680,7 +680,7 @@ AppendIndexStorageInfo(CBuildIndexInfo c_build_index_info,
const char* c_index_store_path,
int64_t data_store_version) {
try {
auto build_index_info = (BuildIndexInfo*)c_build_index_info;
auto build_index_info = static_cast<BuildIndexInfo*>(c_build_index_info);
std::string data_store_path(c_data_store_path),
index_store_path(c_index_store_path);
build_index_info->data_store_path = data_store_path;
Expand Down Expand Up @@ -727,7 +727,7 @@ AppendOptionalFieldDataPath(CBuildIndexInfo c_build_index_info,
const int32_t field_type,
const char* c_file_path) {
try {
auto build_index_info = (BuildIndexInfo*)c_build_index_info;
auto build_index_info = static_cast<BuildIndexInfo*>(c_build_index_info);
std::string field_name_str(field_name);
auto& opt_fields_map = build_index_info->opt_fields;
if (opt_fields_map.find(field_id) == opt_fields_map.end()) {
Expand Down
2 changes: 1 addition & 1 deletion internal/core/src/log/Log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ get_thread_starttime() {
thread_stat, "%lld %s %s ", (long long*)&val, comm, &state); // NOLINT

for (auto i = 4; i < 23; i++) {
ret = fscanf(thread_stat, "%lld ", (long long*)&val); // NOLINT
ret = fscanf(thread_stat, "%lld ", reinterpret_cast<long long*>(&val)); // NOLINT
if (i == 22) {
break;
}
Expand Down
2 changes: 1 addition & 1 deletion internal/core/src/query/SearchOnGrowing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ SearchOnGrowing(const segcore::SegmentGrowingImpl& segment,
auto& schema = segment.get_schema();
auto& record = segment.get_insert_record();
auto active_count =
std::min(int64_t(bitset.size()), segment.get_active_count(timestamp));
std::min(static_cast<int64_t>(bitset.size()), segment.get_active_count(timestamp));

// step 1.1: get meta
// step 1.2: get which vector field to search
Expand Down
4 changes: 2 additions & 2 deletions internal/core/src/segcore/IndexConfigGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ VecIndexConfig::VecIndexConfig(const int64_t max_index_row_cout,
build_params_[knowhere::indexparam::NLIST] =
std::to_string(config_.get_nlist());
build_params_[knowhere::indexparam::SSIZE] = std::to_string(
std::max((int)(config_.get_chunk_rows() / config_.get_nlist()), 48));
std::max(static_cast<int>(config_.get_chunk_rows()) / static_cast<int>(config_.get_nlist()), 48));
search_params_[knowhere::indexparam::NPROBE] =
std::to_string(config_.get_nprobe());
// note for sparse vector index: drop_ratio_build is not allowed for growing
Expand All @@ -71,7 +71,7 @@ VecIndexConfig::GetBuildThreshold() const noexcept {
assert(VecIndexConfig::index_build_ratio.count(index_type_));
auto ratio = VecIndexConfig::index_build_ratio.at(index_type_);
assert(ratio >= 0.0 && ratio < 1.0);
return std::max(int64_t(max_index_row_count_ * ratio),
return std::max(static_cast<int64_t>(max_index_row_count_ * ratio),
config_.get_nlist() * 39);
}

Expand Down
4 changes: 2 additions & 2 deletions internal/core/src/segcore/SegmentGrowingImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ SegmentGrowingImpl::bulk_subscript(FieldId field_id,
DataType::VECTOR_SPARSE_FLOAT) {
bulk_subscript_sparse_float_vector_impl(
field_id,
(const ConcurrentVector<SparseFloatVector>*)vec_ptr,
static_cast<const ConcurrentVector<SparseFloatVector>*>(vec_ptr),
seg_offsets,
count,
result->mutable_vectors()->mutable_sparse_float_vector());
Expand Down Expand Up @@ -675,7 +675,7 @@ SegmentGrowingImpl::bulk_subscript_impl(FieldId field_id,
if (offset == INVALID_SEG_OFFSET) {
memset(dst, 0, element_sizeof);
} else {
auto src = (const uint8_t*)vec.get_element(offset);
auto src = reinterpret_cast<const uint8_t*>(vec.get_element(offset));
memcpy(dst, src, element_sizeof);
}
}
Expand Down

0 comments on commit 783443a

Please sign in to comment.