mirror of
https://github.com/corda/corda.git
synced 2025-01-06 05:04:20 +00:00
fix 32-bit shift case in unsignedShiftRightC
This commit is contained in:
parent
2f864ebea5
commit
935329d7cf
@ -501,11 +501,19 @@ void unsignedShiftRightR(Context* con, unsigned size, Reg* a, Reg* b, Reg* t)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
moveRR(Context* c, unsigned srcSize, Assembler::Register* src,
|
||||||
|
unsigned dstSize, Assembler::Register* dst);
|
||||||
|
|
||||||
void unsignedShiftRightC(Context* con, unsigned size, Const* a, Reg* b, Reg* t)
|
void unsignedShiftRightC(Context* con, unsigned size, Const* a, Reg* b, Reg* t)
|
||||||
{
|
{
|
||||||
int sh = getVal(a);
|
int sh = getVal(a);
|
||||||
if (size == 8) {
|
if (size == 8) {
|
||||||
if (sh < 32) {
|
if (sh == 32) {
|
||||||
|
Assembler::Register high(b->high);
|
||||||
|
moveRR(con, 4, &high, 4, t);
|
||||||
|
issue(con, li(H(t),0));
|
||||||
|
} else if (sh < 32) {
|
||||||
issue(con, srwi(R(t), R(b), sh));
|
issue(con, srwi(R(t), R(b), sh));
|
||||||
issue(con, rlwimi(R(t),H(b),32-sh,0,sh-1));
|
issue(con, rlwimi(R(t),H(b),32-sh,0,sh-1));
|
||||||
issue(con, rlwinm(H(t),H(b),32-sh,sh,31));
|
issue(con, rlwinm(H(t),H(b),32-sh,sh,31));
|
||||||
@ -596,10 +604,6 @@ jumpR(Context* c, unsigned size UNUSED, Assembler::Register* target)
|
|||||||
issue(c, bctr());
|
issue(c, bctr());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
moveRR(Context* c, unsigned srcSize, Assembler::Register* src,
|
|
||||||
unsigned dstSize, Assembler::Register* dst);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
swapRR(Context* c, unsigned aSize, Assembler::Register* a,
|
swapRR(Context* c, unsigned aSize, Assembler::Register* a,
|
||||||
unsigned bSize, Assembler::Register* b)
|
unsigned bSize, Assembler::Register* b)
|
||||||
|
@ -39,6 +39,10 @@ public class Longs {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static long unsignedShiftRight32(long x) {
|
||||||
|
return x >>> 32;
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
expect(((long) negativeOne()) == -1);
|
expect(((long) negativeOne()) == -1);
|
||||||
|
|
||||||
@ -211,6 +215,8 @@ public class Longs {
|
|||||||
buffer.putLong(231);
|
buffer.putLong(231);
|
||||||
buffer.flip();
|
buffer.flip();
|
||||||
expect(buffer.getLong() == 231);
|
expect(buffer.getLong() == 231);
|
||||||
|
|
||||||
|
expect(unsignedShiftRight32(231) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user