Skip to content

Commit

Permalink
Fix hex 64-bit display.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomusdrw committed Dec 31, 2024
1 parent 8821dd9 commit 2bd9b4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/components/Instructions/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const valueToNumeralSystem = (
withPrefix: boolean = true,
): string => {
const stringValue =
typeof value === "bigint" ? BigInt.asUintN(32, value).toString(16) : ((value ?? 0) >>> 0).toString(16);
typeof value === "bigint" ? BigInt.asUintN(64, value).toString(16) : ((value ?? 0) >>> 0).toString(16);

return numeralSystem === NumeralSystem.HEXADECIMAL
? `${withPrefix ? "0x" : ""}${stringValue.padStart(padStartVal, "0")}`
Expand Down
12 changes: 7 additions & 5 deletions src/components/Registers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,15 @@ export const Registers = ({
className="w-20 h-6 m-0 py-0 px-[4px] text-md border-white hover:border-input"
onChange={(e) => {
const value = e.target?.value;
const valueInDecimal =
numeralSystem === NumeralSystem.HEXADECIMAL ? `${parseInt(value, 16)}` : value;
const pcValue =
valueInDecimal && !Number.isNaN(parseInt(valueInDecimal)) ? parseInt(valueInDecimal) : 0;
let newValue = 0;
try {
newValue = Number(value);
} catch (_e) {
newValue = 0;
}
onCurrentStateChange({
...currentState,
pc: pcValue,
pc: newValue,
});
}}
onKeyUp={(e) => {
Expand Down

0 comments on commit 2bd9b4d

Please sign in to comment.