Skip to content

Commit 6e80584

Browse files
committed
bugfix in MRTask, fixed log2 helper function.
1 parent 19c5425 commit 6e80584

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/main/java/water/MRTask.java

+4-7
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,10 @@ public abstract class MRTask extends DRemoteTask {
1010

1111
public long memOverheadPerChunk(){return 0;}
1212

13-
static final long log2(long x){
14-
long y = x >> 1;
15-
while(y > 0){
16-
x = y;
17-
y = x >> 1;
18-
}
19-
return x > 0?y+1:y;
13+
static final long log2(long a){
14+
long x = a, y = 0;
15+
while((x = x >> 1) > 0)++y;
16+
return (a > 1 << y)?y+1:y;
2017
}
2118

2219
@Override public void init() {

0 commit comments

Comments
 (0)