mirror of
https://github.com/nasa/trick.git
synced 2025-02-21 17:36:42 +00:00
Correct decimal formatting for ints in TrickView
3032aae added fixed-width to binary formats. Looks like I modified TVInteger's Decimal format instead of Binary. Refs #661
This commit is contained in:
parent
7ccdade441
commit
d5544a5991
@ -22,7 +22,8 @@ public class TVInteger extends VSInteger implements TrickViewFluent<TVInteger.Fo
|
|||||||
|
|
||||||
Binary {
|
Binary {
|
||||||
public String format(int value, boolean unsigned) {
|
public String format(int value, boolean unsigned) {
|
||||||
return Integer.toBinaryString(value);
|
String result = Integer.toBinaryString(value);
|
||||||
|
return "00000000000000000000000000000000".substring(result.length()) + result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int parse(String value) {
|
public int parse(String value) {
|
||||||
@ -32,14 +33,12 @@ public class TVInteger extends VSInteger implements TrickViewFluent<TVInteger.Fo
|
|||||||
|
|
||||||
Decimal {
|
Decimal {
|
||||||
public String format(int value, boolean unsigned) {
|
public String format(int value, boolean unsigned) {
|
||||||
String result;
|
|
||||||
if (unsigned && value < 0) {
|
if (unsigned && value < 0) {
|
||||||
result = Long.toString(value + 4294967296L);
|
return Long.toString(value + 4294967296L);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result = Integer.toString(value);
|
return Integer.toString(value);
|
||||||
}
|
}
|
||||||
return "00000000000000000000000000000000".substring(result.length()) + result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int parse(String value) {
|
public int parse(String value) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user