use truncation, not rounding in float2Int instructions

This commit is contained in:
Joel Dice 2009-10-20 15:43:24 -06:00
parent 5967246b37
commit 064ad572bc
2 changed files with 6 additions and 2 deletions

View File

@ -2391,14 +2391,14 @@ float2IntRR(Context* c, unsigned aSize, Assembler::Register* a,
unsigned bSize, Assembler::Register* b)
{
assert(c, not floatReg(b));
floatRegOp(c, aSize, a, bSize, b, 0x2d);
floatRegOp(c, aSize, a, bSize, b, 0x2c);
}
void
float2IntMR(Context* c, unsigned aSize, Assembler::Memory* a,
unsigned bSize, Assembler::Register* b)
{
floatMemOp(c, aSize, a, bSize, b, 0x2d);
floatMemOp(c, aSize, a, bSize, b, 0x2c);
}
void

View File

@ -61,5 +61,9 @@ public class Floats {
expect(Math.round(0.5d) == 1);
expect(Math.round(1.0d) == 1);
expect(Math.round(1.9d) == 2);
float b = 1.0f;
int blue = (int)(b * 255 + 0.5);
expect(blue == 255);
}
}