summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2013-10-08 14:10:09 -0400
committerZack Rusin <[email protected]>2013-10-09 18:29:05 -0400
commitc01c6a95b41607dc58a343b2aa67bc3da673ca35 (patch)
treefc2db4ab2392d79375de2a3f2206bcd47e0ac320 /src
parent58bab95c958ee016e82f9fae3c84167de6727048 (diff)
gallivm: support printing of 64 bit integers
only 8 and 32 bit integers were supported before. Signed-off-by: Zack Rusin <[email protected]> Reviewed-by: José Fonseca <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_printf.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_printf.c b/src/gallium/auxiliary/gallivm/lp_bld_printf.c
index 1324da26a71..69d829ea676 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_printf.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_printf.c
@@ -26,6 +26,7 @@
**************************************************************************/
#include <stdio.h>
+#include <inttypes.h>
#include "util/u_debug.h"
#include "util/u_memory.h"
@@ -106,7 +107,11 @@ lp_build_print_value(struct gallivm_state *gallivm,
type_fmt[4] = 'g';
type_fmt[5] = '\0';
} else if (type_kind == LLVMIntegerTypeKind) {
- if (LLVMGetIntTypeWidth(type_ref) == 8) {
+ if (LLVMGetIntTypeWidth(type_ref) == 64) {
+ unsigned flen = strlen(PRId64);
+ assert(flen <= 3);
+ strncpy(type_fmt + 2, PRId64, flen);
+ } else if (LLVMGetIntTypeWidth(type_ref) == 8) {
type_fmt[2] = 'u';
} else {
type_fmt[2] = 'i';