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

View File

@ -1339,7 +1339,13 @@ class ARTIQIRGenerator(algorithm.Visitor):
ir.Constant("True", builtins.TStr()),
ir.Constant("False", builtins.TStr()))))
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)
elif builtins.is_float(value.type):
format_string += "%g"