From 5a0777042742ca6eb33d6f90ca237ab5dc979666 Mon Sep 17 00:00:00 2001 From: Anton Lydike Date: Sun, 17 Apr 2022 12:32:36 +0200 Subject: [PATCH] fixed a bug with hex literal recognition --- riscemu/helpers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/riscemu/helpers.py b/riscemu/helpers.py index 843a85e..0a469b6 100644 --- a/riscemu/helpers.py +++ b/riscemu/helpers.py @@ -7,8 +7,8 @@ SPDX-License-Identifier: MIT from math import log10, ceil from typing import Iterable, Iterator, TypeVar, Generic, List, Optional -from .types.exceptions import * from .types import Int32, UInt32 +from .types.exceptions import * def align_addr(addr: int, to_bytes: int = 8) -> int: @@ -23,7 +23,7 @@ def parse_numeric_argument(arg: str) -> int: parse hex or int strings """ try: - if '0x' in arg or '0X' in arg: + if arg.lower().startswith('0x'): return int(arg, 16) return int(arg) except ValueError as ex: