Skip to content

Commit eb39841

Browse files
committed
fix bug: change Mixing_Data::length from int to size_t
1 parent dcff74d commit eb39841

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

source/module_base/module_mixing/mixing_data.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Base_Mixing
44
{
55

6-
Mixing_Data::Mixing_Data(const int& ndim, const int& length, const size_t& type_size)
6+
Mixing_Data::Mixing_Data(const int& ndim, const std::size_t& length, const size_t& type_size)
77
{
88
this->ndim_tot = ndim;
99
this->length = length;
@@ -19,7 +19,7 @@ Mixing_Data::~Mixing_Data()
1919
free(this->data);
2020
}
2121

22-
void Mixing_Data::resize(const int& ndim, const int& length, const size_t& type_size)
22+
void Mixing_Data::resize(const int& ndim, const std::size_t& length, const size_t& type_size)
2323
{
2424
this->ndim_tot = ndim;
2525
this->length = length;

source/module_base/module_mixing/mixing_data.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Mixing_Data
2222
* @param type_size size of type
2323
*
2424
*/
25-
Mixing_Data(const int& ndim, const int& length, const size_t& type_size);
25+
Mixing_Data(const int& ndim, const std::size_t& length, const size_t& type_size);
2626

2727
/**
2828
* @brief Destroy the Mixing_Data object
@@ -38,7 +38,7 @@ class Mixing_Data
3838
* @param type_size size of type
3939
*
4040
*/
41-
void resize(const int& ndim, const int& length, const size_t& type_size);
41+
void resize(const int& ndim, const std::size_t& length, const size_t& type_size);
4242

4343
/**
4444
* @brief push data to the tensor
@@ -54,7 +54,7 @@ class Mixing_Data
5454
#ifdef _OPENMP
5555
#pragma omp parallel for schedule(static, 4096/sizeof(FPTYPE))
5656
#endif
57-
for (int i = 0; i < length; ++i)
57+
for (std::size_t i = 0; i < length; ++i)
5858
{
5959
FP_startdata[i] = data_in[i];
6060
}
@@ -86,7 +86,7 @@ class Mixing_Data
8686
// the number of vectors for mixing
8787
int ndim_tot = 0;
8888
// the length of each vector
89-
int length = 0;
89+
std::size_t length = 0;
9090
// the start index for vector: start = this->index_move(0)
9191
int start = -1;
9292
// the number of used vectors for mixing

0 commit comments

Comments
 (0)