8001055: Bytes.swap should follow big endian

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
This commit is contained in:
Yumin Qi 2012-10-19 08:58:14 -07:00 committed by Yumin Qi
parent 3d8142d5fd
commit f214e4cef3

View File

@ -30,24 +30,10 @@ import sun.jvm.hotspot.utilities.PlatformInfo;
/** Encapsulates some byte-swapping operations defined in the VM */
public class Bytes {
// swap if client platform is different from server's.
private boolean swap;
public Bytes(MachineDescription machDesc) {
String cpu = PlatformInfo.getCPU();
if (cpu.equals("sparc")) {
if (machDesc.isBigEndian()) {
swap = false;
} else {
swap = true;
}
} else { // intel
if (machDesc.isBigEndian()) {
swap = true;
} else {
swap = false;
}
}
swap = !machDesc.isBigEndian();
}
/** Should only swap if the hardware's underlying byte order is