From 73c62c54044399ca3be26be6370d86881f99b59c Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sun, 8 Dec 2019 13:57:40 +0100 Subject: [PATCH] Minor code simplification --- src/rendering/polyrenderer/drawers/screen_triangle.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rendering/polyrenderer/drawers/screen_triangle.cpp b/src/rendering/polyrenderer/drawers/screen_triangle.cpp index 5dc8caa36..0744af8be 100644 --- a/src/rendering/polyrenderer/drawers/screen_triangle.cpp +++ b/src/rendering/polyrenderer/drawers/screen_triangle.cpp @@ -482,8 +482,8 @@ static void BlendColor(int y, int x0, int x1, PolyTriangleThreadData* thread) int32_t dst = (dstinput >> shiftdst[i]) & 0xff; // Inverse if needed - src = invsrc ? 0xff - src : src; - dst = invdst ? 0xff - dst : dst; + if (invsrc) src = 0xff - src; + if (invdst) dst = 0xff - dst; // Rescale 0-255 to 0-256 src = src + (src >> 7); @@ -559,8 +559,8 @@ static void BlendColor(int y, int x0, int x1, PolyTriangleThreadData* thread) __m128i dst = _mm_and_si128(_mm_srlv_epi32(dstinput, shiftdst), _mm_set1_epi32(0xff)); // Inverse if needed - src = invsrc ? _mm_sub_epi32(_mm_set1_epi32(0xff), src) : src; - dst = invdst ? _mm_sub_epi32(_mm_set1_epi32(0xff), dst) : dst; + if (invsrc) src = _mm_sub_epi32(_mm_set1_epi32(0xff), src); + if (invdst) dst = _mm_sub_epi32(_mm_set1_epi32(0xff), dst); // Rescale 0-255 to 0-256 src = _mm_add_epi32(src, _mm_srli_epi32(src, 7));