Fix sorting of FloatArray and DoubleArray

Use compareTo method instead of comparison operators
This commit is contained in:
Svyatoslav Scherbina
2018-08-31 15:56:09 +03:00
committed by SvyatoslavScherbina
parent d424a1f1ce
commit dd3ce12e28
+4 -4
View File
@@ -274,9 +274,9 @@ private fun partition(
var j = right
val pivot = array[(left + right) / 2]
while (i <= j) {
while (array[i] < pivot)
while (array[i].compareTo(pivot) < 0)
i++
while (array[j] > pivot)
while (array[j].compareTo(pivot) > 0)
j--
if (i <= j) {
val tmp = array[i]
@@ -305,9 +305,9 @@ private fun partition(
var j = right
val pivot = array[(left + right) / 2]
while (i <= j) {
while (array[i] < pivot)
while (array[i].compareTo(pivot) < 0)
i++
while (array[j] > pivot)
while (array[j].compareTo(pivot) > 0)
j--
if (i <= j) {
val tmp = array[i]