From 68b0f2380c358059b39ef0891d33243a0b3e347e Mon Sep 17 00:00:00 2001 From: namark <namark@disroot.org> Date: Sat, 28 Nov 2020 22:52:43 +0400 Subject: [PATCH] Always felt this was a bad variable name, in general introduced it with vector in mind, to do the masking through multiplication... though intrinsic vector has an element-wise ternary... so will need a special mask function here anyway, no need for the variable. --- source/simple/support/algorithm.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/simple/support/algorithm.hpp b/source/simple/support/algorithm.hpp index f905ca5..fcd26d8 100644 --- a/source/simple/support/algorithm.hpp +++ b/source/simple/support/algorithm.hpp @@ -367,11 +367,12 @@ namespace simple::support Integer positive = diff / 2; - auto overflew = b < a; - return a + (overflew ? negative : positive); + return a + (b < a ? negative : positive); // TODO: this is for geom::vector - // return a + overflew * idiff + !overflew * diff; + // auto overflew = b < a; + // return a + overflew * negative + !overflew * positive; + // better yet introduce a mask function, since intrinsic vector has element-wise ternary } -- GitLab