Skip to content

Commit 0208bec

Browse files
committed
Hide zero length immediates
1 parent 1dce285 commit 0208bec

File tree

1 file changed

+37
-20
lines changed

1 file changed

+37
-20
lines changed

src/components/Instructions/utils.tsx

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export const mapInstructionsArgsByType = (
4848
valueFormatted?: string | number;
4949
argumentBitLength?: number;
5050
hidden?: boolean;
51+
hiddenFromDetails?: boolean;
5152
}[]
5253
| null => {
5354
if (!args) return null;
@@ -84,11 +85,15 @@ export const mapInstructionsArgsByType = (
8485
argumentBitLength: bitLengths?.firstImmediateLengthBits,
8586
hidden: true,
8687
},
87-
{
88-
type: argType.IMMEDIATE,
89-
value: valueToNumeralSystem(args?.firstImmediateDecoder.getI64(), numeralSystem),
90-
argumentBitLength: bitLengths?.firstImmediateDecoderBits,
91-
},
88+
...(bitLengths?.firstImmediateLength
89+
? [
90+
{
91+
type: argType.IMMEDIATE,
92+
value: valueToNumeralSystem(args?.firstImmediateDecoder.getI64(), numeralSystem),
93+
argumentBitLength: bitLengths?.firstImmediateDecoderBits,
94+
},
95+
]
96+
: []),
9297
{
9398
type: argType.IMMEDIATE,
9499
value: valueToNumeralSystem(args?.secondImmediateDecoder.getI64(), numeralSystem),
@@ -131,11 +136,15 @@ export const mapInstructionsArgsByType = (
131136
argumentBitLength: bitLengths?.firstImmediateLengthBits,
132137
hidden: true,
133138
},
134-
{
135-
type: argType.IMMEDIATE,
136-
value: valueToNumeralSystem(args?.firstImmediateDecoder.getI64(), numeralSystem),
137-
argumentBitLength: bitLengths?.firstImmediateDecoderBits,
138-
},
139+
...(bitLengths?.firstImmediateLength
140+
? [
141+
{
142+
type: argType.IMMEDIATE,
143+
value: valueToNumeralSystem(args?.firstImmediateDecoder.getI64(), numeralSystem),
144+
argumentBitLength: bitLengths?.firstImmediateDecoderBits,
145+
},
146+
]
147+
: []),
139148
{
140149
type: argType.IMMEDIATE,
141150
value: valueToNumeralSystem(args?.secondImmediateDecoder.getI64(), numeralSystem),
@@ -156,11 +165,15 @@ export const mapInstructionsArgsByType = (
156165
argumentBitLength: bitLengths?.firstImmediateLengthBits,
157166
hidden: true,
158167
},
159-
{
160-
type: argType.IMMEDIATE,
161-
value: valueToNumeralSystem(args?.immediateDecoder.getI64(), numeralSystem),
162-
argumentBitLength: bitLengths?.immediateDecoderBits,
163-
},
168+
...(bitLengths?.firstImmediateLength
169+
? [
170+
{
171+
type: argType.IMMEDIATE,
172+
value: valueToNumeralSystem(args?.immediateDecoder.getI64(), numeralSystem),
173+
argumentBitLength: bitLengths?.immediateDecoderBits,
174+
},
175+
]
176+
: []),
164177
{
165178
type: argType.OFFSET,
166179
value: valueToNumeralSystem(args?.nextPc - counter, numeralSystem),
@@ -256,11 +269,15 @@ export const mapInstructionsArgsByType = (
256269
argumentBitLength: bitLengths?.firstImmediateLengthBits,
257270
hidden: true,
258271
},
259-
{
260-
type: argType.IMMEDIATE,
261-
value: valueToNumeralSystem(args?.firstImmediateDecoder.getI64(), numeralSystem),
262-
argumentBitLength: bitLengths?.firstImmediateDecoderBits,
263-
},
272+
...(bitLengths?.firstImmediateLength
273+
? [
274+
{
275+
type: argType.IMMEDIATE,
276+
value: valueToNumeralSystem(args?.firstImmediateDecoder.getI64(), numeralSystem),
277+
argumentBitLength: bitLengths?.firstImmediateDecoderBits,
278+
},
279+
]
280+
: []),
264281
{
265282
type: argType.IMMEDIATE,
266283
value: valueToNumeralSystem(args?.secondImmediateDecoder.getI64(), numeralSystem),

0 commit comments

Comments
 (0)