Parsing as regular decimal integers instead of hexadecimal.

This commit is contained in:
Brandon Rozek 2024-06-15 08:46:53 -07:00
parent 43bb036008
commit d1c56fa6a5
No known key found for this signature in database
GPG key ID: 26E457DA82C9F480

View file

@ -80,9 +80,8 @@ def carrier_set_from_size(size: int):
def parse_size(infile: TextIO) -> Optional[int]:
Parse the line representing the matrix size.
NOTE: Elements are represented in hexidecimal.
size = int(next(infile), 16)
size = int(next(infile))
if size == -1:
return None
assert size > 0, "Unexpected size"
@ -110,16 +109,16 @@ def parse_negation(infile: TextIO, size: int) -> Optional[ModelFunction]:
def mvalue_from_index(i: int):
Given an index, return the hexidecimal
Given an index, return the
representation of the model value.
return ModelValue(f"a{hex(i)[-1]}")
return ModelValue(f"a{i}")
def parse_mvalue(x: str) -> ModelValue:
Parse an element and return the model value.
return mvalue_from_index(int(x, 16))
return mvalue_from_index(int(x))
def determine_cresult(size: int, ordering: Dict[ModelValue, ModelValue], a: ModelValue, b: ModelValue) -> ModelValue: