mirror of
https://github.com/nasa/trick.git
synced 2025-02-20 17:22:52 +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 {
|
||||
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) {
|
||||
@ -32,14 +33,12 @@ public class TVInteger extends VSInteger implements TrickViewFluent<TVInteger.Fo
|
||||
|
||||
Decimal {
|
||||
public String format(int value, boolean unsigned) {
|
||||
String result;
|
||||
if (unsigned && value < 0) {
|
||||
result = Long.toString(value + 4294967296L);
|
||||
return Long.toString(value + 4294967296L);
|
||||
}
|
||||
else {
|
||||
result = Integer.toString(value);
|
||||
return Integer.toString(value);
|
||||
}
|
||||
return "00000000000000000000000000000000".substring(result.length()) + result;
|
||||
}
|
||||
|
||||
public int parse(String value) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user