mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Fixes java.io.BufferedReader.skip method. Fixes multiplication of
negative long integers
This commit is contained in:
parent
c6ff897bdd
commit
739f666c0a
|
@ -120,13 +120,17 @@ public class TBufferedReader extends TReader {
|
|||
requireOpened();
|
||||
if (n < count - index) {
|
||||
index += n;
|
||||
return n;
|
||||
} else {
|
||||
n -= (count - index);
|
||||
if (innerReader.skip(n) == n) {
|
||||
long skipped = innerReader.skip(n);
|
||||
if (skipped == n) {
|
||||
fillBuffer(0);
|
||||
} else {
|
||||
eof = true;
|
||||
}
|
||||
return skipped;
|
||||
}
|
||||
return super.skip(n);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -486,6 +486,13 @@ Long_isNegative = function(a) {
|
|||
return (a.hi & 0x80000000) !== 0;
|
||||
}
|
||||
Long_mul = function(a, b) {
|
||||
var positive = Long_isNegative(a) === Long_isNegative(b);
|
||||
if (Long_isNegative(a)) {
|
||||
a = Long_neg(a);
|
||||
}
|
||||
if (Long_isNegative(b)) {
|
||||
b = Long_neg(b);
|
||||
}
|
||||
var a_lolo = a.lo & 0xFFFF;
|
||||
var a_lohi = a.lo >>> 16;
|
||||
var a_hilo = a.hi & 0xFFFF;
|
||||
|
@ -499,7 +506,8 @@ Long_mul = function(a, b) {
|
|||
var lohi = (a_lohi * b_lolo + a_lolo * b_lohi + (lolo >> 16)) | 0;
|
||||
var hilo = (a_hilo * b_lolo + a_lohi * b_lohi + a_lolo * b_hilo + (lohi >> 16)) | 0;
|
||||
var hihi = (a_hihi * b_lolo + a_hilo * b_lohi + a_lohi * b_hilo + a_lolo * b_hihi + (hilo >> 16)) | 0;
|
||||
return new Long((lolo & 0xFFFF) | ((lohi & 0xFFFF) << 16), (hilo & 0xFFFF) | ((hihi & 0xFFFF) << 16));
|
||||
var result = new Long((lolo & 0xFFFF) | ((lohi & 0xFFFF) << 16), (hilo & 0xFFFF) | ((hihi & 0xFFFF) << 16));
|
||||
return positive ? result : Long_neg(result);
|
||||
}
|
||||
Long_div = function(a, b) {
|
||||
return Long_divRem(a, b)[0];
|
||||
|
|
|
@ -79,35 +79,5 @@
|
|||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<!--This plugin's configuration is used to store Eclipse m2e settings only.
|
||||
It has no influence on the Maven build itself.-->
|
||||
<plugin>
|
||||
<groupId>org.eclipse.m2e</groupId>
|
||||
<artifactId>lifecycle-mapping</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<configuration>
|
||||
<lifecycleMappingMetadata>
|
||||
<pluginExecutions>
|
||||
<pluginExecution>
|
||||
<pluginExecutionFilter>
|
||||
<groupId>org.teavm</groupId>
|
||||
<artifactId>teavm-maven-plugin</artifactId>
|
||||
<versionRange>[0.0.1-SNAPSHOT,)</versionRange>
|
||||
<goals>
|
||||
<goal>build-javascript</goal>
|
||||
</goals>
|
||||
</pluginExecutionFilter>
|
||||
<action>
|
||||
<ignore></ignore>
|
||||
</action>
|
||||
</pluginExecution>
|
||||
</pluginExecutions>
|
||||
</lifecycleMappingMetadata>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</project>
|
Loading…
Reference in New Issue
Block a user