summaryrefslogtreecommitdiff
path: root/src/resources/dye/dyepalette_replaceacolor.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-12-21 23:02:27 +0300
committerAndrei Karas <akaras@inbox.ru>2016-12-21 23:15:11 +0300
commit6addecc3615d5e3f9caaafd39aa639c8ff49115b (patch)
treed448d51378fbf6b05215109632734212b51d27e7 /src/resources/dye/dyepalette_replaceacolor.cpp
parente59b20b4cff4bf54c0b2ea91dbf09345da9d5fe4 (diff)
downloadplus-6addecc3615d5e3f9caaafd39aa639c8ff49115b.tar.gz
plus-6addecc3615d5e3f9caaafd39aa639c8ff49115b.tar.bz2
plus-6addecc3615d5e3f9caaafd39aa639c8ff49115b.tar.xz
plus-6addecc3615d5e3f9caaafd39aa639c8ff49115b.zip
Use precalculated values for A and S dyes.
Diffstat (limited to 'src/resources/dye/dyepalette_replaceacolor.cpp')
-rw-r--r--src/resources/dye/dyepalette_replaceacolor.cpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/resources/dye/dyepalette_replaceacolor.cpp b/src/resources/dye/dyepalette_replaceacolor.cpp
index f98c52343..7c24d6c1f 100644
--- a/src/resources/dye/dyepalette_replaceacolor.cpp
+++ b/src/resources/dye/dyepalette_replaceacolor.cpp
@@ -31,14 +31,6 @@
#ifdef __x86_64__
// avx2
#include "immintrin.h"
-
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
-#define buildHex(a, b, c, d) \
- (d) * 16777216U + (c) * 65536U + (b) * 256U + CAST_U32(a)
-#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
-#define buildHex(a, b, c, d) \
- (a) * 16777216U + (b) * 65536U + (c) * 256U + CAST_U32(d)
-#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
#endif // __x86_64__
#include "debug.h"
@@ -177,8 +169,8 @@ void DyePalette::replaceAColorSimd(uint32_t *restrict pixels,
++ it;
const DyeColor &col2 = *it;
- __m256i newMask = _mm256_set1_epi32(buildHex(col2.value[0], col2.value[1], col2.value[2], col2.value[3]));
- __m256i cmpMask = _mm256_set1_epi32(buildHex(col.value[0], col.value[1], col.value[2], col.value[3]));
+ __m256i newMask = _mm256_set1_epi32(col2.valueA);
+ __m256i cmpMask = _mm256_set1_epi32(col.valueA);
__m256i cmpRes = _mm256_cmpeq_epi32(base, cmpMask);
__m256i srcAnd = _mm256_andnot_si256(cmpRes, base);
__m256i dstAnd = _mm256_and_si256(cmpRes, newMask);