mirror of https://github.com/m-labs/artiq.git
compiler/ir_values: fix gcd64
This commit is contained in:
parent
4915b4b5aa
commit
86193437f5
|
@ -208,12 +208,12 @@ class VBool(VInt):
|
||||||
# Fraction type
|
# Fraction type
|
||||||
|
|
||||||
def _gcd64(builder, a, b):
|
def _gcd64(builder, a, b):
|
||||||
gcd_f = builder.module.get_function_named("__gcd64")
|
gcd_f = builder.basic_block.function.module.get_function_named("__gcd64")
|
||||||
return builder.call(gcd_f, [a, b])
|
return builder.call(gcd_f, [a, b])
|
||||||
|
|
||||||
|
|
||||||
def _frac_normalize(builder, numerator, denominator):
|
def _frac_normalize(builder, numerator, denominator):
|
||||||
gcd = _gcd64(numerator, denominator)
|
gcd = _gcd64(builder, numerator, denominator)
|
||||||
numerator = builder.sdiv(numerator, gcd)
|
numerator = builder.sdiv(numerator, gcd)
|
||||||
denominator = builder.sdiv(denominator, gcd)
|
denominator = builder.sdiv(denominator, gcd)
|
||||||
return numerator, denominator
|
return numerator, denominator
|
||||||
|
|
Loading…
Reference in New Issue