forked from M-Labs/artiq
1
0
Fork 0

Use the correct printf format for 64-bit integers.

This commit is contained in:
whitequark 2015-07-22 03:05:15 +03:00
parent 236d5b886a
commit 86e006830c
1 changed files with 7 additions and 1 deletions

View File

@ -1339,7 +1339,13 @@ class ARTIQIRGenerator(algorithm.Visitor):
ir.Constant("True", builtins.TStr()), ir.Constant("True", builtins.TStr()),
ir.Constant("False", builtins.TStr())))) ir.Constant("False", builtins.TStr()))))
elif builtins.is_int(value.type): elif builtins.is_int(value.type):
format_string += "%d" width = builtins.get_int_width(value.type)
if width <= 32:
format_string += "%ld"
elif width <= 64:
format_string += "%lld"
else:
assert False
args.append(value) args.append(value)
elif builtins.is_float(value.type): elif builtins.is_float(value.type):
format_string += "%g" format_string += "%g"