forked from M-Labs/artiq
1
0
Fork 0

compiler/ir_values: fix gcd64

This commit is contained in:
Sebastien Bourdeauducq 2014-09-05 16:48:27 +08:00
parent 4915b4b5aa
commit 86193437f5
1 changed files with 2 additions and 2 deletions

View File

@ -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