Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix signed integer overflow #572

Merged
merged 1 commit into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions smt/src/rmts/rmtc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ void RMTC::compute_uniq2elem(double * data, int * rows, int * cols) {
}

void RMTC::compute_full_from_block(double * mtx, double * data, int * rows, int * cols){
int inz = 0;
long inz = 0;

for (int ielem = 0; ielem < nelem; ielem++) {
for (int iterm1 = 0; iterm1 < nterm; iterm1++) {
for (int iterm2 = 0; iterm2 < nterm; iterm2++) {
for (long ielem = 0; ielem < nelem; ielem++) {
for (long iterm1 = 0; iterm1 < nterm; iterm1++) {
for (long iterm2 = 0; iterm2 < nterm; iterm2++) {
data[inz] = mtx[iterm1 * nterm + iterm2];
rows[inz] = ielem * nterm + iterm1;
cols[inz] = ielem * nterm + iterm2;
Expand Down
2 changes: 1 addition & 1 deletion smt/src/rmts/rmtc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class RMTC : public RMTS {
void find_interval(int ix, int num, double x, int * index, double * xbar);
int * nelem_list;
int * nterm_list;
int nelem, nterm;
long nelem, nterm;
};

#endif