Skip to content

Commit 30fa03a

Browse files
committed
fix: use uint64_t for indices
1 parent b8d55e2 commit 30fa03a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

program/c/src/oracle/model/price_model.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ void heapsort(int64_t * a, uint64_t n) {
1414
/*
1515
* This is a bottom-up heapify which is linear in time.
1616
*/
17-
for (int i = n / 2 - 1; i >= 0; i--) {
17+
for (uint64_t i = n / 2 - 1; i >= 0; i--) {
1818
int64_t root = a[i];
19-
int j = i * 2 + 1;
19+
uint64_t j = i * 2 + 1;
2020
while (j < n) {
2121
if (j + 1 < n && a[j] < a[j + 1]) j++;
2222
if (root >= a[j]) break;
@@ -26,13 +26,13 @@ void heapsort(int64_t * a, uint64_t n) {
2626
a[(j - 1) / 2] = root;
2727
}
2828

29-
for (int i = n - 1; i > 0; i--) {
29+
for (uint64_t i = n - 1; i > 0; i--) {
3030
int64_t tmp = a[0];
3131
a[0] = a[i];
3232
a[i] = tmp;
3333

3434
int64_t root = a[0];
35-
int j = 1;
35+
uint64_t j = 1;
3636
while (j < i) {
3737
if (j + 1 < i && a[j] < a[j + 1]) j++;
3838
if (root >= a[j]) break;

0 commit comments

Comments
 (0)