From 082c08789cf9a8c0cc2bf44d0fee579b96c0798f Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 8 Oct 2013 09:40:34 +0100 Subject: sna: Rework the num_threads refinement to avoid the division We can replace the division by a multiplication. Signed-off-by: Chris Wilson --- src/sna/sna_trapezoids.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/sna/sna_trapezoids.c') diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c index 8827b9c6..f14a67c9 100644 --- a/src/sna/sna_trapezoids.c +++ b/src/sna/sna_trapezoids.c @@ -390,7 +390,7 @@ trapezoids_fallback(struct sna *sna, y = bounds.y1; dy = (height + num_threads - 1) / num_threads; - num_threads = (bounds.y2 - bounds.y1 + dy - 1) / dy; + num_threads -= (num_threads-1) * dy >= bounds.y2 - bounds.y1; for (n = 1; n < num_threads; n++) { threads[n] = threads[0]; -- cgit v1.2.3