diff options
author | Eugene Tarassov | 2017-06-01 17:20:53 +0000 |
---|---|---|
committer | Eugene Tarassov | 2017-06-01 17:20:53 +0000 |
commit | e2561c688737bc6f5f35ab1065b5c55f88498cfd (patch) | |
tree | 241cdce2cf5657667ba3a7fd911420d50f1546c1 | |
parent | 4065756d687cfb28113f8ff382227b4816a0ad30 (diff) | |
download | org.eclipse.tcf-e2561c688737bc6f5f35ab1065b5c55f88498cfd.tar.gz org.eclipse.tcf-e2561c688737bc6f5f35ab1065b5c55f88498cfd.tar.xz org.eclipse.tcf-e2561c688737bc6f5f35ab1065b5c55f88498cfd.zip |
Bug 517609 - TCFNumberFormat toByteArray method does not perform sign extension properly in big endian mode
-rw-r--r-- | plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNumberFormat.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNumberFormat.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNumberFormat.java index 11ce576a2..76fc092cb 100644 --- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNumberFormat.java +++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFNumberFormat.java @@ -78,7 +78,7 @@ public class TCFNumberFormat { boolean sign_extention = false; if (!fp) { BigInteger n = new BigInteger(s, radix); - sign_extention = n.signum() < 0; + sign_extention = n.signum() < 0; bf = n.toByteArray(); } else if (size == 4) { @@ -188,7 +188,8 @@ public class TCFNumberFormat { } byte[] rs = new byte[size]; if (rs.length > bf.length && sign_extention) { - for (int i = bf.length; i < rs.length; i++) rs[i] = (byte)0xff; + // It is easier to fill all bytes instead of checking big_endian + for (int i = 0; i < rs.length; i++) rs[i] = (byte)0xff; } for (int i = 0; i < bf.length; i++) { // i == 0 -> least significant byte |