diff --git a/desmume/src/utils/colorspacehandler/colorspacehandler_AVX2.cpp b/desmume/src/utils/colorspacehandler/colorspacehandler_AVX2.cpp index 378015905..122b829cf 100644 --- a/desmume/src/utils/colorspacehandler/colorspacehandler_AVX2.cpp +++ b/desmume/src/utils/colorspacehandler/colorspacehandler_AVX2.cpp @@ -194,14 +194,14 @@ FORCEINLINE void ColorspaceConvert555xTo6665Opaque_AVX2(const v256u16 &srcColor, template FORCEINLINE void ColorspaceConvert5551To8888_AVX2(const v256u16 &srcColor, v256u32 &dstLo, v256u32 &dstHi) { - const v256u16 srcAlphaBits16 = _mm256_and_si256( _mm256_cmpgt_epi16(srcColor, _mm256_set1_epi16(0xFFFF)), _mm256_set1_epi16(0xFF00) ); + const v256u16 srcAlphaBits16 = _mm256_and_si256( _mm256_cmpgt_epi16(_mm256_setzero_si256(), srcColor), _mm256_set1_epi16(0xFF00) ); ColorspaceConvert555aTo8888_AVX2(srcColor, srcAlphaBits16, dstLo, dstHi); } template FORCEINLINE void ColorspaceConvert5551To6665_AVX2(const v256u16 &srcColor, v256u32 &dstLo, v256u32 &dstHi) { - const v256u16 srcAlphaBits16 = _mm256_and_si256( _mm256_cmpgt_epi16(srcColor, _mm256_set1_epi16(0xFFFF)), _mm256_set1_epi16(0x1F00) ); + const v256u16 srcAlphaBits16 = _mm256_and_si256( _mm256_cmpgt_epi16(_mm256_setzero_si256(), srcColor), _mm256_set1_epi16(0x1F00) ); ColorspaceConvert555aTo6665_AVX2(srcColor, srcAlphaBits16, dstLo, dstHi); } diff --git a/desmume/src/utils/colorspacehandler/colorspacehandler_AVX512.cpp b/desmume/src/utils/colorspacehandler/colorspacehandler_AVX512.cpp index 0c404687e..ea1824b05 100644 --- a/desmume/src/utils/colorspacehandler/colorspacehandler_AVX512.cpp +++ b/desmume/src/utils/colorspacehandler/colorspacehandler_AVX512.cpp @@ -115,14 +115,14 @@ FORCEINLINE void ColorspaceConvert555xTo6665Opaque_AVX512(const v512u16 &srcColo template FORCEINLINE void ColorspaceConvert5551To8888_AVX512(const v512u16 &srcColor, v512u32 &dstLo, v512u32 &dstHi) { - const v512u16 srcAlphaBits16 = _mm512_and_si512( _mm512_cmpgt_epi16(srcColor, _mm512_set1_epi16(0xFFFF)), _mm512_set1_epi16(0xFF00) ); + const v512u16 srcAlphaBits16 = _mm512_and_si512( _mm512_cmpgt_epi16(_mm512_setzero_si512(), srcColor), _mm512_set1_epi16(0xFF00) ); ColorspaceConvert555aTo8888_AVX512(srcColor, srcAlphaBits16, dstLo, dstHi); } template FORCEINLINE void ColorspaceConvert5551To6665_AVX512(const v512u16 &srcColor, v512u32 &dstLo, v512u32 &dstHi) { - const v512u16 srcAlphaBits16 = _mm512_and_si512( _mm512_cmpgt_epi16(srcColor, _mm512_set1_epi16(0xFFFF)), _mm512_set1_epi16(0x1F00) ); + const v512u16 srcAlphaBits16 = _mm512_and_si512( _mm512_cmpgt_epi16(_mm512_setzero_si512(), srcColor), _mm512_set1_epi16(0x1F00) ); ColorspaceConvert555aTo6665_AVX512(srcColor, srcAlphaBits16, dstLo, dstHi); } diff --git a/desmume/src/utils/colorspacehandler/colorspacehandler_AltiVec.cpp b/desmume/src/utils/colorspacehandler/colorspacehandler_AltiVec.cpp index 68ea0cb30..ef97a4921 100755 --- a/desmume/src/utils/colorspacehandler/colorspacehandler_AltiVec.cpp +++ b/desmume/src/utils/colorspacehandler/colorspacehandler_AltiVec.cpp @@ -136,14 +136,14 @@ FORCEINLINE void ColorspaceConvert555xTo6665Opaque_AltiVec(const v128u16 &srcCol template FORCEINLINE void ColorspaceConvert5551To8888_AltiVec(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi) { - const v128u16 srcAlphaBits16 = (v128u16)vec_cmpgt( (v128s16)srcColor, ((v128s16){0xFFFF,0xFFFF, 0xFFFF,0xFFFF, 0xFFFF,0xFFFF, 0xFFFF,0xFFFF}) ); + const v128u16 srcAlphaBits16 = (v128u16)vec_cmpgt( ((v128s16){0,0, 0,0, 0,0, 0,0}), (v128s16)srcColor ); ColorspaceConvert555aTo8888_AltiVec(srcColor, srcAlphaBits16, dstLo, dstHi); } template FORCEINLINE void ColorspaceConvert5551To6665_AltiVec(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi) { - const v128u16 srcAlphaBits16 = vec_and( (v128u16)vec_cmpgt( (v128s16)srcColor, ((v128s16){0xFFFF,0xFFFF, 0xFFFF,0xFFFF, 0xFFFF,0xFFFF, 0xFFFF,0xFFFF}) ), ((v128u16){0x1F1F,0x1F1F, 0x1F1F,0x1F1F, 0x1F1F,0x1F1F, 0x1F1F,0x1F1F}) ); + const v128u16 srcAlphaBits16 = vec_and( (v128u16)vec_cmpgt( ((v128s16){0,0, 0,0, 0,0, 0,0}), (v128s16)srcColor ), ((v128u16){0x1F1F,0x1F1F, 0x1F1F,0x1F1F, 0x1F1F,0x1F1F, 0x1F1F,0x1F1F}) ); ColorspaceConvert555aTo6665_AltiVec(srcColor, srcAlphaBits16, dstLo, dstHi); } diff --git a/desmume/src/utils/colorspacehandler/colorspacehandler_NEON.cpp b/desmume/src/utils/colorspacehandler/colorspacehandler_NEON.cpp index 3557c3975..fa6641fb4 100644 --- a/desmume/src/utils/colorspacehandler/colorspacehandler_NEON.cpp +++ b/desmume/src/utils/colorspacehandler/colorspacehandler_NEON.cpp @@ -168,14 +168,14 @@ FORCEINLINE void ColorspaceConvert555xTo6665Opaque_NEON(const v128u16 &srcColor, template FORCEINLINE void ColorspaceConvert5551To8888_NEON(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi) { - const v128s16 srcAlphaBits16 = vandq_s16( vcgtq_s16(vreinterpretq_u16_s16(srcColor), vdupq_n_s16(0xFFFF)), vdupq_n_s16(0xFF00) ); + const v128s16 srcAlphaBits16 = vandq_s16( vcgtq_s16(vdupq_n_s16(0), vreinterpretq_u16_s16(srcColor)), vdupq_n_s16(0xFF00) ); ColorspaceConvert555aTo8888_NEON(srcColor, vreinterpretq_s16_u16(srcAlphaBits16), dstLo, dstHi); } template FORCEINLINE void ColorspaceConvert5551To6665_NEON(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi) { - const v128s16 srcAlphaBits16 = vandq_s16( vcgtq_s16(vreinterpretq_u16_s16(srcColor), vdupq_n_s16(0xFFFF)), vdupq_n_s16(0x1F00) ); + const v128s16 srcAlphaBits16 = vandq_s16( vcgtq_s16(vdupq_n_s16(0), vreinterpretq_u16_s16(srcColor)), vdupq_n_s16(0x1F00) ); ColorspaceConvert555aTo6665_NEON(srcColor, vreinterpretq_s16_u16(srcAlphaBits16), dstLo, dstHi); } diff --git a/desmume/src/utils/colorspacehandler/colorspacehandler_SSE2.cpp b/desmume/src/utils/colorspacehandler/colorspacehandler_SSE2.cpp index 77e6ae22e..491856b2f 100644 --- a/desmume/src/utils/colorspacehandler/colorspacehandler_SSE2.cpp +++ b/desmume/src/utils/colorspacehandler/colorspacehandler_SSE2.cpp @@ -178,14 +178,14 @@ FORCEINLINE void ColorspaceConvert555xTo6665Opaque_SSE2(const v128u16 &srcColor, template FORCEINLINE void ColorspaceConvert5551To8888_SSE2(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi) { - const v128u16 srcAlphaBits16 = _mm_and_si128( _mm_cmpgt_epi16(srcColor, _mm_set1_epi16(0xFFFF)), _mm_set1_epi16(0xFF00) ); + const v128u16 srcAlphaBits16 = _mm_and_si128( _mm_cmpgt_epi16(_mm_setzero_si128(), srcColor), _mm_set1_epi16(0xFF00) ); ColorspaceConvert555aTo8888_SSE2(srcColor, srcAlphaBits16, dstLo, dstHi); } template FORCEINLINE void ColorspaceConvert5551To6665_SSE2(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi) { - const v128u16 srcAlphaBits16 = _mm_and_si128( _mm_cmpgt_epi16(srcColor, _mm_set1_epi16(0xFFFF)), _mm_set1_epi16(0x1F00) ); + const v128u16 srcAlphaBits16 = _mm_and_si128( _mm_cmpgt_epi16(_mm_setzero_si128(), srcColor), _mm_set1_epi16(0x1F00) ); ColorspaceConvert555aTo6665_SSE2(srcColor, srcAlphaBits16, dstLo, dstHi); }