Skip to content

Commit c33a3ce

Browse files
[pre-commit.ci lite] apply automatic fixes
1 parent 5981ee0 commit c33a3ce

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

source/module_base/mymath.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ void heapAjust(double *r, int *ind, int s, int m)
1717

1818
for (j = 2 * s; j <= m; j *= 2)
1919
{
20-
if (j < m && (r[j] < r[j + 1]))
20+
if (j < m && (r[j] < r[j + 1])) {
2121
j++;
22+
}
2223

23-
if (!(rc < r[j]))
24+
if (!(rc < r[j])) {
2425
break;
26+
}
2527

2628
r[s] = r[j];
2729

@@ -97,12 +99,14 @@ void hpsort(int n, double *ra, int *ind)
9799

98100
if (ind[0] == 0)
99101
{
100-
for (i = 1; i <= n; i++)
102+
for (i = 1; i <= n; i++) {
101103
ind[i - 1] = i;
104+
}
102105
}
103106

104-
if (n < 2)
107+
if (n < 2) {
105108
return; // nothing to order
109+
}
106110

107111
k = n / 2;
108112

@@ -146,8 +150,9 @@ void hpsort(int n, double *ra, int *ind)
146150
}
147151
else if (ra[j] == ra[j + 1])
148152
{
149-
if (ind[j] < ind[j + 1])
153+
if (ind[j] < ind[j + 1]) {
150154
j = j + 1;
155+
}
151156
}
152157
}
153158

@@ -167,11 +172,13 @@ void hpsort(int n, double *ra, int *ind)
167172
i = j;
168173
j = j + j + 1;
169174
}
170-
else
175+
else {
171176
j = ir + 1; // set j to terminate do-while loop
177+
}
172178
}
173-
else // this is the right place for rra
179+
else { // this is the right place for rra
174180
j = ir + 1; // set j to terminate do-while loop
181+
}
175182
}
176183

177184
ra[i] = rra;

0 commit comments

Comments
 (0)