Open iSunfield opened 1 year ago
@iSunfield You have to create a new Int[12].
a = Int[12](20)
b = Int[8](15)
c = Int[12](int(a) * int(b))
print(c) # 300
Currently we do not have a overload for arbitrary width multiplications. Until we add that (planned), you can look at intn.codon
and maybe roll your own. For example:
@extend Int:
def __add__(self: Int[N], b: Int[X], X: Static[int]):
Z = (N if N > X else X) + 1
return Int[Z](self) + Int[Z](b)
I've tried performing a multiplication operation with integers (Int[N]) of different bit lengths and encountered an error. It seems that operations between different bit lengths are not currently supported for Int[N]. Is it possible to create a new class that supports operations between differing bit lengths? If so, how should I specify the bit length of each argument in the definition of the operation function?