mirror of
https://github.com/corda/corda.git
synced 2025-03-18 01:55:19 +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)
|
||||
{
|
||||
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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user