Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
#ifdef WITH_SSE
|
||||
|
||||
GNU_TARGET(SSE_TARGET)
|
||||
static inline void InsertFirstUint32(const uint32 value, __m128i &into)
|
||||
static inline void InsertFirstUint32(const uint32_t value, __m128i &into)
|
||||
{
|
||||
#if (SSE_VERSION >= 4)
|
||||
into = _mm_insert_epi32(into, value, 0);
|
||||
@@ -24,7 +24,7 @@ static inline void InsertFirstUint32(const uint32 value, __m128i &into)
|
||||
}
|
||||
|
||||
GNU_TARGET(SSE_TARGET)
|
||||
static inline void InsertSecondUint32(const uint32 value, __m128i &into)
|
||||
static inline void InsertSecondUint32(const uint32_t value, __m128i &into)
|
||||
{
|
||||
#if (SSE_VERSION >= 4)
|
||||
into = _mm_insert_epi32(into, value, 1);
|
||||
@@ -35,7 +35,7 @@ static inline void InsertSecondUint32(const uint32 value, __m128i &into)
|
||||
}
|
||||
|
||||
GNU_TARGET(SSE_TARGET)
|
||||
static inline void LoadUint64(const uint64 value, __m128i &into)
|
||||
static inline void LoadUint64(const uint64_t value, __m128i &into)
|
||||
{
|
||||
#ifdef POINTER_IS_64BIT
|
||||
into = _mm_cvtsi64_si128(value);
|
||||
@@ -75,7 +75,7 @@ static inline __m128i DistributeAlpha(const __m128i from, const __m128i &mask)
|
||||
GNU_TARGET(SSE_TARGET)
|
||||
static inline __m128i AlphaBlendTwoPixels(__m128i src, __m128i dst, const __m128i &distribution_mask, const __m128i &pack_mask, const __m128i &alpha_mask)
|
||||
{
|
||||
__m128i srcAB = _mm_unpacklo_epi8(src, _mm_setzero_si128()); // PUNPCKLBW, expand each uint8 into uint16
|
||||
__m128i srcAB = _mm_unpacklo_epi8(src, _mm_setzero_si128()); // PUNPCKLBW, expand each uint8_t into uint16
|
||||
__m128i dstAB = _mm_unpacklo_epi8(dst, _mm_setzero_si128());
|
||||
|
||||
__m128i alphaMaskAB = _mm_cmpgt_epi16(srcAB, _mm_setzero_si128()); // PCMPGTW (alpha > 0) ? 0xFFFF : 0
|
||||
@@ -111,19 +111,19 @@ static inline __m128i DarkenTwoPixels(__m128i src, __m128i dst, const __m128i &d
|
||||
|
||||
IGNORE_UNINITIALIZED_WARNING_START
|
||||
GNU_TARGET(SSE_TARGET)
|
||||
static Colour ReallyAdjustBrightness(Colour colour, uint8 brightness)
|
||||
static Colour ReallyAdjustBrightness(Colour colour, uint8_t brightness)
|
||||
{
|
||||
uint64 c16 = colour.b | (uint64) colour.g << 16 | (uint64) colour.r << 32;
|
||||
uint64_t c16 = colour.b | (uint64_t) colour.g << 16 | (uint64_t) colour.r << 32;
|
||||
c16 *= brightness;
|
||||
uint64 c16_ob = c16; // Helps out of order execution.
|
||||
uint64_t c16_ob = c16; // Helps out of order execution.
|
||||
c16 /= Blitter_32bppBase::DEFAULT_BRIGHTNESS;
|
||||
c16 &= 0x01FF01FF01FFULL;
|
||||
|
||||
/* Sum overbright (maximum for each rgb is 508, 9 bits, -255 is changed in -256 so we just have to take the 8 lower bits into account). */
|
||||
c16_ob = (((c16_ob >> (8 + 7)) & 0x0100010001ULL) * 0xFF) & c16;
|
||||
const uint ob = ((uint16) c16_ob + (uint16) (c16_ob >> 16) + (uint16) (c16_ob >> 32)) / 2;
|
||||
const uint ob = ((uint16_t) c16_ob + (uint16_t) (c16_ob >> 16) + (uint16_t) (c16_ob >> 32)) / 2;
|
||||
|
||||
const uint32 alpha32 = colour.data & 0xFF000000;
|
||||
const uint32_t alpha32 = colour.data & 0xFF000000;
|
||||
__m128i ret;
|
||||
LoadUint64(c16, ret);
|
||||
if (ob != 0) {
|
||||
@@ -145,7 +145,7 @@ IGNORE_UNINITIALIZED_WARNING_STOP
|
||||
/** ReallyAdjustBrightness() is not called that often.
|
||||
* Inlining this function implies a far jump, which has a huge latency.
|
||||
*/
|
||||
static inline Colour AdjustBrightneSSE(Colour colour, uint8 brightness)
|
||||
static inline Colour AdjustBrightneSSE(Colour colour, uint8_t brightness)
|
||||
{
|
||||
/* Shortcut for normal brightness. */
|
||||
if (brightness == Blitter_32bppBase::DEFAULT_BRIGHTNESS) return colour;
|
||||
@@ -154,7 +154,7 @@ static inline Colour AdjustBrightneSSE(Colour colour, uint8 brightness)
|
||||
}
|
||||
|
||||
GNU_TARGET(SSE_TARGET)
|
||||
static inline __m128i AdjustBrightnessOfTwoPixels(__m128i from, uint32 brightness)
|
||||
static inline __m128i AdjustBrightnessOfTwoPixels(__m128i from, uint32_t brightness)
|
||||
{
|
||||
#if (SSE_VERSION < 3)
|
||||
NOT_REACHED();
|
||||
@@ -298,7 +298,7 @@ inline void Blitter_32bppSSE4::Draw(const Blitter::BlitterParams *bp, ZoomLevel
|
||||
for (uint x = (uint) effective_width / 2; x > 0; x--) {
|
||||
__m128i srcABCD = _mm_loadl_epi64((const __m128i*) src);
|
||||
__m128i dstABCD = _mm_loadl_epi64((__m128i*) dst);
|
||||
uint32 mvX2 = *((uint32 *) const_cast<MapValue *>(src_mv));
|
||||
uint32_t mvX2 = *((uint32_t *) const_cast<MapValue *>(src_mv));
|
||||
|
||||
/* Remap colours. */
|
||||
if (mvX2 & 0x00FF00FF) {
|
||||
@@ -314,12 +314,12 @@ inline void Blitter_32bppSSE4::Draw(const Blitter::BlitterParams *bp, ZoomLevel
|
||||
m_colour = m != 0 ? m_colour : srcm; \
|
||||
}
|
||||
#ifdef POINTER_IS_64BIT
|
||||
uint64 srcs = _mm_cvtsi128_si64(srcABCD);
|
||||
uint64 remapped_src = 0;
|
||||
uint64_t srcs = _mm_cvtsi128_si64(srcABCD);
|
||||
uint64_t remapped_src = 0;
|
||||
CMOV_REMAP(c0, 0, srcs, mvX2);
|
||||
remapped_src = c0.data;
|
||||
CMOV_REMAP(c1, 0, srcs >> 32, mvX2 >> 16);
|
||||
remapped_src |= (uint64) c1.data << 32;
|
||||
remapped_src |= (uint64_t) c1.data << 32;
|
||||
srcABCD = _mm_cvtsi64_si128(remapped_src);
|
||||
#else
|
||||
Colour remapped_src[2];
|
||||
@@ -396,7 +396,7 @@ bmcr_alpha_blend_single:
|
||||
for (uint x = (uint) bp->width; x > 0; x--) {
|
||||
if (src_mv->m == 0) {
|
||||
if (src->a != 0) {
|
||||
uint8 g = MakeDark(src->r, src->g, src->b);
|
||||
uint8_t g = MakeDark(src->r, src->g, src->b);
|
||||
*dst = ComposeColourRGBA(g, g, g, src->a, *dst);
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user