ARTEMIS-3466 byte arrays can have negative hex numbers in web console

This commit is contained in:
Justin Bertram 2021-09-09 14:19:01 -05:00
parent 57156ba064
commit 4dd643cbec
1 changed files with 8 additions and 6 deletions

View File

@ -746,12 +746,14 @@ var Artemis;
textArr.push(String.fromCharCode(b)); textArr.push(String.fromCharCode(b));
} }
if (code === 1 || code === 4) { if (code === 1 || code === 4) {
var unsignedByte = b & 0xff;
if (unsignedByte < 16) {
// hex and must be 2 digit so they space out evenly // hex and must be 2 digit so they space out evenly
var s = b.toString(16); bytesArr.push('0' + unsignedByte.toString(16));
if (s.length === 1) { } else {
s = "0" + s; bytesArr.push(unsignedByte.toString(16));
} }
bytesArr.push(s);
} else { } else {
// just show as is without spacing out, as that is usually more used for hex than decimal // just show as is without spacing out, as that is usually more used for hex than decimal
var s = b.toString(10); var s = b.toString(10);