Skip to content

Commit 85615ca

Browse files
committed
fixed most of the issues
1 parent 6523ab3 commit 85615ca

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/lib/loadInstructions.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ into an array of single characters, each representing one bit.
2828
Returns null if the string isn’t 16 or 32 bits long.
2929
*/
3030
function parseMatchBits(matchStr) {
31-
// if (!matchStr) return null;
3231
if (matchStr.length !== 16 && matchStr.length !== 32) {
3332
throw new Error(`Invalid match string length ${len}; expected 16 or 32`);
34-
} return matchStr.split("");
33+
}
34+
return matchStr.split("");
3535
}
3636

3737
/*
@@ -58,7 +58,6 @@ function parseLocationSegments(loc) {
5858
})
5959
}
6060

61-
6261
/*
6362
Extract all variable and constant fields from an instruction definition.
6463
@@ -210,14 +209,12 @@ function expandBitfieldFields(fields, totalBits = 32) {
210209
: [{ from: field.from, to: field.to }];
211210

212211
for (const seg of segments) {
213-
const hi = seg.from;
214-
const lo = seg.to;
215-
const width = hi - lo + 1;
212+
const width = seg.from - seg.to + 1;
216213
const label = field.label;
217214
expanded.push({
218215
label,
219-
from: hi,
220-
to: lo,
216+
from: seg.from,
217+
to: seg.to,
221218
width,
222219
kind: field.kind
223220
});

0 commit comments

Comments
 (0)