[Mesa-dev] [PATCH 3/4] gallivm: (trivial) do division by 1000 with int64

sroland at vmware.com sroland at vmware.com
Mon Apr 23 04:24:37 UTC 2018


From: Roland Scheidegger <sroland at vmware.com>

Conversion to int can otherwise overflow if compile times are over
~71min. (Yes this can happen...)
---
 src/gallium/auxiliary/gallivm/lp_bld_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c
index abca624..d0afff1 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_init.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c
@@ -624,7 +624,7 @@ gallivm_compile_module(struct gallivm_state *gallivm)
 
    if (gallivm_debug & GALLIVM_DEBUG_PERF) {
       int64_t time_end = os_time_get();
-      int time_msec = (int)(time_end - time_begin) / 1000;
+      int time_msec = (int)((time_end - time_begin) / 1000);
       assert(gallivm->module_name);
       debug_printf("optimizing module %s took %d msec\n",
                    gallivm->module_name, time_msec);
-- 
2.7.4



More information about the mesa-dev mailing list