diff options
author | Benny Baumann <BenBE@geshi.org> | 2020-10-31 23:28:02 +0100 |
---|---|---|
committer | Benny Baumann <BenBE@geshi.org> | 2020-11-02 22:15:01 +0100 |
commit | 61e14d4bb25268593019e6df3eb02264b4ac8e0e (patch) | |
tree | 910b68d9a5ee1c4d25b2cf3ee24abaaf3e6a096b /Vector.c | |
parent | b23f8235e28472c410dcb00893e0e3d403892673 (diff) |
Spacing around operators
Diffstat (limited to 'Vector.c')
-rw-r--r-- | Vector.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -118,7 +118,8 @@ static int partition(Object** array, int left, int right, int pivotIndex, Object static void quickSort(Object** array, int left, int right, Object_Compare compare) { if (left >= right) return; - int pivotIndex = (left+right) / 2; + + int pivotIndex = (left + right) / 2; int pivotNewIndex = partition(array, left, right, pivotIndex, compare); quickSort(array, left, pivotNewIndex - 1, compare); quickSort(array, pivotNewIndex + 1, right, compare); @@ -148,17 +149,18 @@ static void combSort(Object** array, int left, int right, Object_Compare compare */ static void insertionSort(Object** array, int left, int right, Object_Compare compare) { - for (int i = left+1; i <= right; i++) { + for (int i = left + 1; i <= right; i++) { Object* t = array[i]; int j = i - 1; while (j >= left) { //comparisons++; if (compare(array[j], t) <= 0) break; - array[j+1] = array[j]; + + array[j + 1] = array[j]; j--; } - array[j+1] = t; + array[j + 1] = t; } } @@ -260,7 +262,7 @@ void Vector_set(Vector* this, int idx, void* data_) { Vector_checkArraySize(this); if (idx >= this->items) { - this->items = idx+1; + this->items = idx + 1; } else { if (this->owner) { Object* removed = this->array[idx]; @@ -293,7 +295,7 @@ void Vector_add(Vector* this, void* data_) { assert(Vector_isConsistent(this)); int i = this->items; Vector_set(this, this->items, data); - assert(this->items == i+1); (void)(i); + assert(this->items == i + 1); (void)(i); assert(Vector_isConsistent(this)); } |