mirror of
https://gitlab.uni-marburg.de/langbeid/powersort.git
synced 2025-01-21 19:50:35 +01:00
Updated the power function to use integers
This commit is contained in:
parent
88f8df3c07
commit
2b85e4e956
@ -459,13 +459,22 @@ public class FasterFinnSort<T> {
|
||||
|
||||
int n_1 = this.runLen[stackSize - 1];
|
||||
int n_2 = this.runLen[stackSize];
|
||||
double a = ((double) this.runBase[stackSize - 1] + 0.5d * n_1 - 1d) / rangeSize;
|
||||
double b = ((double) this.runBase[stackSize] + 0.5d * n_2 - 1d) / rangeSize;
|
||||
int l = 0;
|
||||
while ((int) (a * pow(2, l)) == (int) (b * pow(2 ,l))) {
|
||||
l++;
|
||||
|
||||
int a = 2 * this.runBase[stackSize - 1] + n_1;
|
||||
int b = a + n_1 + n_2;
|
||||
|
||||
int result = 0;
|
||||
|
||||
while (b < rangeSize) {
|
||||
++result;
|
||||
if (a >= rangeSize) {
|
||||
a -= rangeSize;
|
||||
b -= rangeSize;
|
||||
}
|
||||
return l;
|
||||
a <<= 1;
|
||||
b <<= 1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user