From 06704026119043c9f62e3a499a907d94b8155907 Mon Sep 17 00:00:00 2001 From: bjoo Date: Thu, 15 Jan 2015 14:25:27 -0500 Subject: [PATCH] Added upper guard to qdp_dispatch.h --- include/qdp_dispatch.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/qdp_dispatch.h b/include/qdp_dispatch.h index 1408bbeff..e12fd615e 100644 --- a/include/qdp_dispatch.h +++ b/include/qdp_dispatch.h @@ -32,7 +32,8 @@ void dispatch_to_threads(int numSiteTable, Arg a, void (*func)(int,int,int, Arg* threads_num = omp_get_num_threads(); myId = omp_get_thread_num(); low = numSiteTable*myId/threads_num; - high = numSiteTable*(myId+1)/threads_num; + int hi = numSiteTable*(myId+1)/threads_num; + high = ( hi > numSiteTable ) ? numSiteTable : hi; func(low, high, myId, &a); }