mirror of
https://github.com/corda/corda.git
synced 2025-05-04 17:53:05 +00:00
use truncation, not rounding in float2Int instructions
This commit is contained in:
parent
5967246b37
commit
064ad572bc
@ -2391,14 +2391,14 @@ float2IntRR(Context* c, unsigned aSize, Assembler::Register* a,
|
|||||||
unsigned bSize, Assembler::Register* b)
|
unsigned bSize, Assembler::Register* b)
|
||||||
{
|
{
|
||||||
assert(c, not floatReg(b));
|
assert(c, not floatReg(b));
|
||||||
floatRegOp(c, aSize, a, bSize, b, 0x2d);
|
floatRegOp(c, aSize, a, bSize, b, 0x2c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
float2IntMR(Context* c, unsigned aSize, Assembler::Memory* a,
|
float2IntMR(Context* c, unsigned aSize, Assembler::Memory* a,
|
||||||
unsigned bSize, Assembler::Register* b)
|
unsigned bSize, Assembler::Register* b)
|
||||||
{
|
{
|
||||||
floatMemOp(c, aSize, a, bSize, b, 0x2d);
|
floatMemOp(c, aSize, a, bSize, b, 0x2c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -61,5 +61,9 @@ public class Floats {
|
|||||||
expect(Math.round(0.5d) == 1);
|
expect(Math.round(0.5d) == 1);
|
||||||
expect(Math.round(1.0d) == 1);
|
expect(Math.round(1.0d) == 1);
|
||||||
expect(Math.round(1.9d) == 2);
|
expect(Math.round(1.9d) == 2);
|
||||||
|
|
||||||
|
float b = 1.0f;
|
||||||
|
int blue = (int)(b * 255 + 0.5);
|
||||||
|
expect(blue == 255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user