diff options
| author | VinÃcius dos Santos Oliveira <vini.ipsmaker@gmail.com> | 2013-09-13 07:00:18 +0000 |
|---|---|---|
| committer | VinÃcius dos Santos Oliveira <vini.ipsmaker@gmail.com> | 2013-09-13 07:00:18 +0000 |
| commit | 0f397bdb1eae4d190a5a7d7a4792d0571917753b (patch) | |
| tree | 3898ca27cedb36503dfd13818880062566fdc6aa /src/libdepixelize/priv/branchless.h | |
| parent | Removing obvious comments from PixelArtDialog (diff) | |
| download | inkscape-0f397bdb1eae4d190a5a7d7a4792d0571917753b.tar.gz inkscape-0f397bdb1eae4d190a5a7d7a4792d0571917753b.zip | |
Bumping new version of libdepixelize
(bzr r12506.1.3)
Diffstat (limited to 'src/libdepixelize/priv/branchless.h')
| -rw-r--r-- | src/libdepixelize/priv/branchless.h | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/src/libdepixelize/priv/branchless.h b/src/libdepixelize/priv/branchless.h index f8f041cce..487a9688d 100644 --- a/src/libdepixelize/priv/branchless.h +++ b/src/libdepixelize/priv/branchless.h @@ -32,31 +32,13 @@ namespace Tracer { */ namespace branchless { -template<class T> -T first_if(T first, T second, bool cond) -{ - return first * cond + second * (1 - cond); -} - -template<class T> -T min(T first, T second) -{ - return first - (first > second) * (first - second); -} - -template<class T> -T max(T first, T second) -{ - return first + (first < second) * (second - first); -} - -/** - * When abs(first - second) == 1 +/* + * All modern processors optimize the branch to a conditional move */ template<class T> -T max_consecutive(T first, T second) +T first_if(T first, T second, bool cond) { - return first + (first < second); + return cond ? first : second; } } // namespace branchless |
