fixes i2f i2d implementation. Fixes image drawing bugs on Mac OS X.

Also fixes a crash caused by implementing StringBuffer.toString(float)
This commit is contained in:
Eric Scharff 2007-10-25 14:26:51 -06:00
parent d4656e8a52
commit a81b77a37e
3 changed files with 9 additions and 4 deletions

View File

@ -40,6 +40,11 @@ public class StringBuffer {
return this;
}
public synchronized StringBuffer append(float v) {
sb.append(v);
return this;
}
public synchronized StringBuffer append(char[] b, int offset, int length) {
sb.append(b, offset, length);
return this;

View File

@ -207,14 +207,14 @@ hash(const uint16_t* s, unsigned length)
inline uint32_t
floatToBits(float f)
{
int32_t bits; memcpy(&bits, &f, 4);
uint32_t bits; memcpy(&bits, &f, 4);
return bits;
}
inline uint64_t
doubleToBits(double d)
{
int64_t bits; memcpy(&bits, &d, 8);
uint64_t bits; memcpy(&bits, &d, 8);
return bits;
}

View File

@ -1479,11 +1479,11 @@ interpret(Thread* t)
} goto loop;
case i2d: {
pushDouble(t, static_cast<double>(popInt(t)));
pushDouble(t, static_cast<double>(static_cast<int32_t>(popInt(t))));
} goto loop;
case i2f: {
pushFloat(t, static_cast<float>(popInt(t)));
pushFloat(t, static_cast<float>(static_cast<int32_t>(popInt(t))));
} goto loop;
case i2l: {