avoid more conversions to BigDecimal

pull/42/head
Zlatin Balevsky 2020-03-17 16:39:41 +00:00
parent 244015465a
commit fbb710cfc8
3 changed files with 3 additions and 3 deletions

View File

@ -106,7 +106,7 @@ class ContentUploader extends Uploader {
return done ? 100 : 0 return done ? 100 : 0
int position = mapped.position() int position = mapped.position()
int total = request.getRange().end - request.getRange().start int total = request.getRange().end - request.getRange().start
(int)(position * 100.0 / total) (int)(position * 100.0d / total)
} }
@Override @Override

View File

@ -45,7 +45,7 @@ class HashListUploader extends Uploader {
@Override @Override
public synchronized int getProgress() { public synchronized int getProgress() {
(int)(mapped.position() * 100.0 / mapped.capacity()) (int)(mapped.position() * 100.0d / mapped.capacity())
} }
@Override @Override

View File

@ -49,7 +49,7 @@ abstract class Uploader {
final long now = System.currentTimeMillis() final long now = System.currentTimeMillis()
long interval = Math.max(1000, now - lastSpeedRead) long interval = Math.max(1000, now - lastSpeedRead)
lastSpeedRead = now; lastSpeedRead = now;
int currSpeed = (int) (dataSinceLastRead * 1000.0 / interval) int currSpeed = (int) (dataSinceLastRead * 1000.0d / interval)
dataSinceLastRead = 0 dataSinceLastRead = 0
// normalize to speedArr.size // normalize to speedArr.size