提交 8c235999 编写于 作者: M minqi

8001055: Bytes.swap should follow big endian

Summary: This is a mistake change in 6879063 about Bytes.swap. Java byte code order always follows big endian, but in that change, assume they follow native platform order that is not right.
Reviewed-by: coleenp, sspitsyn, dholmes
Contributed-by: yumin.qi@oracle.com
上级 6e872cfa
...@@ -30,24 +30,10 @@ import sun.jvm.hotspot.utilities.PlatformInfo; ...@@ -30,24 +30,10 @@ import sun.jvm.hotspot.utilities.PlatformInfo;
/** Encapsulates some byte-swapping operations defined in the VM */ /** Encapsulates some byte-swapping operations defined in the VM */
public class Bytes { public class Bytes {
// swap if client platform is different from server's.
private boolean swap; private boolean swap;
public Bytes(MachineDescription machDesc) { public Bytes(MachineDescription machDesc) {
String cpu = PlatformInfo.getCPU(); swap = !machDesc.isBigEndian();
if (cpu.equals("sparc")) {
if (machDesc.isBigEndian()) {
swap = false;
} else {
swap = true;
}
} else { // intel
if (machDesc.isBigEndian()) {
swap = true;
} else {
swap = false;
}
}
} }
/** Should only swap if the hardware's underlying byte order is /** Should only swap if the hardware's underlying byte order is
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册