Replace uses of cassert with Common/Assert.h

This commit is contained in:
Pokechu22 2021-04-01 14:30:01 -07:00
parent a2fa9aab5b
commit 004dfd1586
20 changed files with 66 additions and 63 deletions

View File

@ -5,7 +5,6 @@
#ifdef ANDROID #ifdef ANDROID
#include "AudioCommon/OpenSLESStream.h" #include "AudioCommon/OpenSLESStream.h"
#include <cassert>
#include <cmath> #include <cmath>
#include <SLES/OpenSLES.h> #include <SLES/OpenSLES.h>
@ -36,8 +35,8 @@ static int curBuffer = 0;
static void bqPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void* context) static void bqPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void* context)
{ {
assert(bq == bqPlayerBufferQueue); ASSERT(bq == bqPlayerBufferQueue);
assert(nullptr == context); ASSERT(nullptr == context);
// Render to the fresh buffer // Render to the fresh buffer
g_mixer->Mix(reinterpret_cast<short*>(buffer[curBuffer]), BUFFER_SIZE_IN_SAMPLES); g_mixer->Mix(reinterpret_cast<short*>(buffer[curBuffer]), BUFFER_SIZE_IN_SAMPLES);
@ -56,15 +55,15 @@ bool OpenSLESStream::Init()
SLresult result; SLresult result;
// create engine // create engine
result = slCreateEngine(&engineObject, 0, nullptr, 0, nullptr, nullptr); result = slCreateEngine(&engineObject, 0, nullptr, 0, nullptr, nullptr);
assert(SL_RESULT_SUCCESS == result); ASSERT(SL_RESULT_SUCCESS == result);
result = (*engineObject)->Realize(engineObject, SL_BOOLEAN_FALSE); result = (*engineObject)->Realize(engineObject, SL_BOOLEAN_FALSE);
assert(SL_RESULT_SUCCESS == result); ASSERT(SL_RESULT_SUCCESS == result);
result = (*engineObject)->GetInterface(engineObject, SL_IID_ENGINE, &engineEngine); result = (*engineObject)->GetInterface(engineObject, SL_IID_ENGINE, &engineEngine);
assert(SL_RESULT_SUCCESS == result); ASSERT(SL_RESULT_SUCCESS == result);
result = (*engineEngine)->CreateOutputMix(engineEngine, &outputMixObject, 0, 0, 0); result = (*engineEngine)->CreateOutputMix(engineEngine, &outputMixObject, 0, 0, 0);
assert(SL_RESULT_SUCCESS == result); ASSERT(SL_RESULT_SUCCESS == result);
result = (*outputMixObject)->Realize(outputMixObject, SL_BOOLEAN_FALSE); result = (*outputMixObject)->Realize(outputMixObject, SL_BOOLEAN_FALSE);
assert(SL_RESULT_SUCCESS == result); ASSERT(SL_RESULT_SUCCESS == result);
SLDataLocator_AndroidSimpleBufferQueue loc_bufq = {SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, 2}; SLDataLocator_AndroidSimpleBufferQueue loc_bufq = {SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, 2};
SLDataFormat_PCM format_pcm = {SL_DATAFORMAT_PCM, SLDataFormat_PCM format_pcm = {SL_DATAFORMAT_PCM,
@ -87,21 +86,21 @@ bool OpenSLESStream::Init()
result = result =
(*engineEngine) (*engineEngine)
->CreateAudioPlayer(engineEngine, &bqPlayerObject, &audioSrc, &audioSnk, 2, ids, req); ->CreateAudioPlayer(engineEngine, &bqPlayerObject, &audioSrc, &audioSnk, 2, ids, req);
assert(SL_RESULT_SUCCESS == result); ASSERT(SL_RESULT_SUCCESS == result);
result = (*bqPlayerObject)->Realize(bqPlayerObject, SL_BOOLEAN_FALSE); result = (*bqPlayerObject)->Realize(bqPlayerObject, SL_BOOLEAN_FALSE);
assert(SL_RESULT_SUCCESS == result); ASSERT(SL_RESULT_SUCCESS == result);
result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_PLAY, &bqPlayerPlay); result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_PLAY, &bqPlayerPlay);
assert(SL_RESULT_SUCCESS == result); ASSERT(SL_RESULT_SUCCESS == result);
result = result =
(*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_BUFFERQUEUE, &bqPlayerBufferQueue); (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_BUFFERQUEUE, &bqPlayerBufferQueue);
assert(SL_RESULT_SUCCESS == result); ASSERT(SL_RESULT_SUCCESS == result);
result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_VOLUME, &bqPlayerVolume); result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_VOLUME, &bqPlayerVolume);
assert(SL_RESULT_SUCCESS == result); ASSERT(SL_RESULT_SUCCESS == result);
result = (*bqPlayerBufferQueue)->RegisterCallback(bqPlayerBufferQueue, bqPlayerCallback, nullptr); result = (*bqPlayerBufferQueue)->RegisterCallback(bqPlayerBufferQueue, bqPlayerCallback, nullptr);
assert(SL_RESULT_SUCCESS == result); ASSERT(SL_RESULT_SUCCESS == result);
result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PLAYING); result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PLAYING);
assert(SL_RESULT_SUCCESS == result); ASSERT(SL_RESULT_SUCCESS == result);
// Render and enqueue a first buffer. // Render and enqueue a first buffer.
curBuffer ^= 1; curBuffer ^= 1;

View File

@ -5,6 +5,8 @@
#include <cstring> #include <cstring>
#include "AudioCommon/PulseAudioStream.h" #include "AudioCommon/PulseAudioStream.h"
#include "Common/Assert.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/Thread.h" #include "Common/Thread.h"
@ -104,7 +106,7 @@ bool PulseAudio::PulseInit()
} }
ss.channels = m_channels; ss.channels = m_channels;
ss.rate = m_mixer->GetSampleRate(); ss.rate = m_mixer->GetSampleRate();
assert(pa_sample_spec_valid(&ss)); ASSERT(pa_sample_spec_valid(&ss));
m_pa_s = pa_stream_new(m_pa_ctx, "Playback", &ss, channel_map_p); m_pa_s = pa_stream_new(m_pa_ctx, "Playback", &ss, channel_map_p);
pa_stream_set_write_callback(m_pa_s, WriteCallback, this); pa_stream_set_write_callback(m_pa_s, WriteCallback, this);
pa_stream_set_underflow_callback(m_pa_s, UnderflowCallback, this); pa_stream_set_underflow_callback(m_pa_s, UnderflowCallback, this);

View File

@ -5,12 +5,12 @@
#include "Core/HW/GCMemcard/GCMemcard.h" #include "Core/HW/GCMemcard/GCMemcard.h"
#include <algorithm> #include <algorithm>
#include <cassert>
#include <cinttypes> #include <cinttypes>
#include <cstring> #include <cstring>
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "Common/Assert.h"
#include "Common/BitUtils.h" #include "Common/BitUtils.h"
#include "Common/ColorUtil.h" #include "Common/ColorUtil.h"
#include "Common/CommonFuncs.h" #include "Common/CommonFuncs.h"
@ -240,7 +240,7 @@ std::pair<GCMemcardErrorCode, std::optional<GCMemcard>> GCMemcard::Open(std::str
else else
{ {
// should never reach here // should never reach here
assert(0); ASSERT(false);
} }
} }
@ -329,7 +329,7 @@ bool GCMemcard::Save()
static std::pair<u16, u16> CalculateMemcardChecksums(const u8* data, size_t size) static std::pair<u16, u16> CalculateMemcardChecksums(const u8* data, size_t size)
{ {
assert(size % 2 == 0); ASSERT(size % 2 == 0);
u16 csum = 0; u16 csum = 0;
u16 inv_csum = 0; u16 inv_csum = 0;
@ -779,7 +779,7 @@ GCMemcardErrorCode BlockAlloc::CheckForErrors(u16 size_mbits) const
{ {
// check if free block count matches the actual amount of free blocks in m_map // check if free block count matches the actual amount of free blocks in m_map
const u16 total_available_blocks = (size_mbits * MBIT_TO_BLOCKS) - MC_FST_BLOCKS; const u16 total_available_blocks = (size_mbits * MBIT_TO_BLOCKS) - MC_FST_BLOCKS;
assert(total_available_blocks <= m_map.size()); ASSERT(total_available_blocks <= m_map.size());
u16 blocks_in_use = 0; u16 blocks_in_use = 0;
for (size_t i = 0; i < total_available_blocks; ++i) for (size_t i = 0; i < total_available_blocks; ++i)
{ {

View File

@ -1,10 +1,10 @@
#include "Core/HW/GCMemcard/GCMemcardUtils.h" #include "Core/HW/GCMemcard/GCMemcardUtils.h"
#include <array> #include <array>
#include <cassert>
#include <string> #include <string>
#include <vector> #include <vector>
#include "Common/Assert.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/IOFile.h" #include "Common/IOFile.h"
#include "Common/NandPaths.h" #include "Common/NandPaths.h"
@ -330,7 +330,7 @@ std::string GetDefaultExtension(SavefileFormat format)
case SavefileFormat::SAV: case SavefileFormat::SAV:
return ".sav"; return ".sav";
default: default:
assert(0); ASSERT(false);
return ".gci"; return ".gci";
} }
} }

View File

@ -2,11 +2,11 @@
// Licensed under GPLv2+ // Licensed under GPLv2+
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <cassert> #include "Core/HW/WiimoteCommon/DataReport.h"
#include "Common/Assert.h"
#include "Common/BitUtils.h" #include "Common/BitUtils.h"
#include "Common/MathUtil.h" #include "Common/MathUtil.h"
#include "Core/HW/WiimoteCommon/DataReport.h"
namespace WiimoteCommon namespace WiimoteCommon
{ {
@ -308,7 +308,7 @@ std::unique_ptr<DataReportManipulator> MakeDataReportManipulator(InputReportID r
ptr = std::make_unique<ReportInterleave2>(); ptr = std::make_unique<ReportInterleave2>();
break; break;
default: default:
assert(false); ASSERT(false);
break; break;
} }

View File

@ -5,9 +5,9 @@
#include "Core/HW/WiimoteEmu/Extension/Classic.h" #include "Core/HW/WiimoteEmu/Extension/Classic.h"
#include <array> #include <array>
#include <cassert>
#include <string_view> #include <string_view>
#include "Common/Assert.h"
#include "Common/BitUtils.h" #include "Common/BitUtils.h"
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
@ -204,7 +204,7 @@ ControllerEmu::ControlGroup* Classic::GetGroup(ClassicGroup group)
case ClassicGroup::RightStick: case ClassicGroup::RightStick:
return m_right_stick; return m_right_stick;
default: default:
assert(false); ASSERT(false);
return nullptr; return nullptr;
} }
} }

View File

@ -5,8 +5,8 @@
#include "Core/HW/WiimoteEmu/Extension/DrawsomeTablet.h" #include "Core/HW/WiimoteEmu/Extension/DrawsomeTablet.h"
#include <array> #include <array>
#include <cassert>
#include "Common/Assert.h"
#include "Common/BitUtils.h" #include "Common/BitUtils.h"
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
@ -101,7 +101,7 @@ ControllerEmu::ControlGroup* DrawsomeTablet::GetGroup(DrawsomeTabletGroup group)
case DrawsomeTabletGroup::Touch: case DrawsomeTabletGroup::Touch:
return m_touch; return m_touch;
default: default:
assert(false); ASSERT(false);
return nullptr; return nullptr;
} }
} }

View File

@ -4,9 +4,9 @@
#include "Core/HW/WiimoteEmu/Extension/Drums.h" #include "Core/HW/WiimoteEmu/Extension/Drums.h"
#include <cassert>
#include <type_traits> #include <type_traits>
#include "Common/Assert.h"
#include "Common/BitUtils.h" #include "Common/BitUtils.h"
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
@ -199,7 +199,7 @@ ControllerEmu::ControlGroup* Drums::GetGroup(DrumsGroup group)
case DrumsGroup::Stick: case DrumsGroup::Stick:
return m_stick; return m_stick;
default: default:
assert(false); ASSERT(false);
return nullptr; return nullptr;
} }
} }

View File

@ -5,10 +5,10 @@
#include "Core/HW/WiimoteEmu/Extension/Guitar.h" #include "Core/HW/WiimoteEmu/Extension/Guitar.h"
#include <array> #include <array>
#include <cassert>
#include <cstring> #include <cstring>
#include <map> #include <map>
#include "Common/Assert.h"
#include "Common/BitUtils.h" #include "Common/BitUtils.h"
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
@ -164,7 +164,7 @@ ControllerEmu::ControlGroup* Guitar::GetGroup(GuitarGroup group)
case GuitarGroup::SliderBar: case GuitarGroup::SliderBar:
return m_slider_bar; return m_slider_bar;
default: default:
assert(false); ASSERT(false);
return nullptr; return nullptr;
} }
} }

View File

@ -6,9 +6,9 @@
#include <algorithm> #include <algorithm>
#include <array> #include <array>
#include <cassert>
#include <cstring> #include <cstring>
#include "Common/Assert.h"
#include "Common/BitUtils.h" #include "Common/BitUtils.h"
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
@ -170,7 +170,7 @@ ControllerEmu::ControlGroup* Nunchuk::GetGroup(NunchukGroup group)
case NunchukGroup::IMUAccelerometer: case NunchukGroup::IMUAccelerometer:
return m_imu_accelerometer; return m_imu_accelerometer;
default: default:
assert(false); ASSERT(false);
return nullptr; return nullptr;
} }
} }

View File

@ -5,9 +5,9 @@
#include "Core/HW/WiimoteEmu/Extension/TaTaCon.h" #include "Core/HW/WiimoteEmu/Extension/TaTaCon.h"
#include <array> #include <array>
#include <cassert>
#include <cstring> #include <cstring>
#include "Common/Assert.h"
#include "Common/BitUtils.h" #include "Common/BitUtils.h"
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
@ -80,7 +80,7 @@ ControllerEmu::ControlGroup* TaTaCon::GetGroup(TaTaConGroup group)
case TaTaConGroup::Rim: case TaTaConGroup::Rim:
return m_rim; return m_rim;
default: default:
assert(false); ASSERT(false);
return nullptr; return nullptr;
} }
} }

View File

@ -5,9 +5,9 @@
#include "Core/HW/WiimoteEmu/Extension/Turntable.h" #include "Core/HW/WiimoteEmu/Extension/Turntable.h"
#include <array> #include <array>
#include <cassert>
#include <cstring> #include <cstring>
#include "Common/Assert.h"
#include "Common/BitUtils.h" #include "Common/BitUtils.h"
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
@ -163,7 +163,7 @@ ControllerEmu::ControlGroup* Turntable::GetGroup(TurntableGroup group)
case TurntableGroup::Crossfade: case TurntableGroup::Crossfade:
return m_crossfade; return m_crossfade;
default: default:
assert(false); ASSERT(false);
return nullptr; return nullptr;
} }
} }

View File

@ -5,8 +5,8 @@
#include "Core/HW/WiimoteEmu/Extension/UDrawTablet.h" #include "Core/HW/WiimoteEmu/Extension/UDrawTablet.h"
#include <array> #include <array>
#include <cassert>
#include "Common/Assert.h"
#include "Common/BitUtils.h" #include "Common/BitUtils.h"
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
@ -130,7 +130,7 @@ ControllerEmu::ControlGroup* UDrawTablet::GetGroup(UDrawTabletGroup group)
case UDrawTabletGroup::Touch: case UDrawTabletGroup::Touch:
return m_touch; return m_touch;
default: default:
assert(false); ASSERT(false);
return nullptr; return nullptr;
} }
} }

View File

@ -5,12 +5,12 @@
#include "Core/HW/WiimoteEmu/WiimoteEmu.h" #include "Core/HW/WiimoteEmu/WiimoteEmu.h"
#include <algorithm> #include <algorithm>
#include <cassert>
#include <memory> #include <memory>
#include <string_view> #include <string_view>
#include <fmt/format.h> #include <fmt/format.h>
#include "Common/Assert.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/Config/Config.h" #include "Common/Config/Config.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
@ -338,7 +338,7 @@ ControllerEmu::ControlGroup* Wiimote::GetWiimoteGroup(WiimoteGroup group) const
case WiimoteGroup::IMUPoint: case WiimoteGroup::IMUPoint:
return m_imu_ir; return m_imu_ir;
default: default:
assert(false); ASSERT(false);
return nullptr; return nullptr;
} }
} }

View File

@ -5,7 +5,6 @@
#include "Core/NetPlayClient.h" #include "Core/NetPlayClient.h"
#include <algorithm> #include <algorithm>
#include <cassert>
#include <cstddef> #include <cstddef>
#include <cstring> #include <cstring>
#include <fstream> #include <fstream>
@ -2026,7 +2025,7 @@ bool NetPlayClient::WiimoteUpdate(int _number, u8* data, const std::size_t size,
} }
} }
assert(nw.data.size() == size); ASSERT(nw.data.size() == size);
std::copy(nw.data.begin(), nw.data.end(), data); std::copy(nw.data.begin(), nw.data.end(), data);
return true; return true;
} }

View File

@ -5,7 +5,6 @@
#include "Core/PowerPC/Interpreter/Interpreter.h" #include "Core/PowerPC/Interpreter/Interpreter.h"
#include <array> #include <array>
#include <cassert>
#include <cinttypes> #include <cinttypes>
#include <string> #include <string>

View File

@ -5,7 +5,6 @@
#include "DiscIO/VolumeVerifier.h" #include "DiscIO/VolumeVerifier.h"
#include <algorithm> #include <algorithm>
#include <cassert>
#include <future> #include <future>
#include <limits> #include <limits>
#include <memory> #include <memory>
@ -696,7 +695,7 @@ bool VolumeVerifier::ShouldHaveChannelPartition() const
"RFNE01", "RFNJ01", "RFNK01", "RFNP01", "RFNW01", "RFPE01", "RFPJ01", "RFPK01", "RFPP01", "RFNE01", "RFNJ01", "RFNK01", "RFNP01", "RFNW01", "RFPE01", "RFPJ01", "RFPK01", "RFPP01",
"RFPW01", "RGWE41", "RGWJ41", "RGWP41", "RGWX41", "RMCE01", "RMCJ01", "RMCK01", "RMCP01", "RFPW01", "RGWE41", "RGWJ41", "RGWP41", "RGWX41", "RMCE01", "RMCJ01", "RMCK01", "RMCP01",
}; };
assert(std::is_sorted(channel_discs.cbegin(), channel_discs.cend())); DEBUG_ASSERT(std::is_sorted(channel_discs.cbegin(), channel_discs.cend()));
return std::binary_search(channel_discs.cbegin(), channel_discs.cend(), return std::binary_search(channel_discs.cbegin(), channel_discs.cend(),
std::string_view(m_volume.GetGameID())); std::string_view(m_volume.GetGameID()));
@ -729,7 +728,7 @@ bool VolumeVerifier::ShouldBeDualLayer() const
"SLSEXJ", "SLSP01", "SQIE4Q", "SQIP4Q", "SQIY4Q", "SR5E41", "SR5P41", "SUOE41", "SUOP41", "SLSEXJ", "SLSP01", "SQIE4Q", "SQIP4Q", "SQIY4Q", "SR5E41", "SR5P41", "SUOE41", "SUOP41",
"SVXX52", "SVXY52", "SX4E01", "SX4P01", "SZ3EGT", "SZ3PGT", "SVXX52", "SVXY52", "SX4E01", "SX4P01", "SZ3EGT", "SZ3PGT",
}; };
assert(std::is_sorted(dual_layer_discs.cbegin(), dual_layer_discs.cend())); DEBUG_ASSERT(std::is_sorted(dual_layer_discs.cbegin(), dual_layer_discs.cend()));
return std::binary_search(dual_layer_discs.cbegin(), dual_layer_discs.cend(), return std::binary_search(dual_layer_discs.cbegin(), dual_layer_discs.cend(),
std::string_view(m_volume.GetGameID())); std::string_view(m_volume.GetGameID()));

View File

@ -5,7 +5,6 @@
#include "DolphinQt/GCMemcardManager.h" #include "DolphinQt/GCMemcardManager.h"
#include <algorithm> #include <algorithm>
#include <cassert>
#include <string> #include <string>
#include <vector> #include <vector>
@ -29,6 +28,7 @@
#include <QTimer> #include <QTimer>
#include <QToolButton> #include <QToolButton>
#include "Common/Assert.h"
#include "Common/CommonPaths.h" #include "Common/CommonPaths.h"
#include "Common/Config/Config.h" #include "Common/Config/Config.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
@ -387,7 +387,7 @@ static QString GetFormatDescription(Memcard::SavefileFormat format)
case Memcard::SavefileFormat::SAV: case Memcard::SavefileFormat::SAV:
return QObject::tr("Datel MaxDrive/Pro files"); return QObject::tr("Datel MaxDrive/Pro files");
default: default:
assert(0); ASSERT(0);
return QObject::tr("Native GCI File"); return QObject::tr("Native GCI File");
} }
} }

View File

@ -2,8 +2,9 @@
// Licensed under GPLv2+ // Licensed under GPLv2+
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "InputCommon/ControlReference/ExpressionParser.h"
#include <algorithm> #include <algorithm>
#include <cassert>
#include <cmath> #include <cmath>
#include <functional> #include <functional>
#include <iostream> #include <iostream>
@ -14,10 +15,10 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "Common/Assert.h"
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "InputCommon/ControlReference/ExpressionParser.h"
#include "InputCommon/ControlReference/FunctionExpression.h" #include "InputCommon/ControlReference/FunctionExpression.h"
namespace ciface::ExpressionParser namespace ciface::ExpressionParser
@ -384,7 +385,7 @@ public:
return std::max(std::min(1 - lval, rval), std::min(lval, 1 - rval)); return std::max(std::min(1 - lval, rval), std::min(lval, 1 - rval));
} }
default: default:
assert(false); ASSERT(false);
return 0; return 0;
} }
} }
@ -823,7 +824,7 @@ private:
case TOK_COMMA: case TOK_COMMA:
return 8; return 8;
default: default:
assert(false); ASSERT(false);
return 0; return 0;
} }
} }

View File

@ -6,6 +6,10 @@
#include <cmath> #include <cmath>
#include <cstring> #include <cstring>
#ifdef CHECK
#include "Common/Assert.h"
#endif
#include "Common/CPUDetect.h" #include "Common/CPUDetect.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/Intrinsics.h" #include "Common/Intrinsics.h"
@ -1362,8 +1366,8 @@ static void TexDecoder_DecodeImpl_CMPR(u32* dst, const u8* src, int width, int h
dst32[(width * 0) + 6] = colors1[(dxt1sel >> ((0 * 8) + 2)) & 3]; dst32[(width * 0) + 6] = colors1[(dxt1sel >> ((0 * 8) + 2)) & 3];
dst32[(width * 0) + 7] = colors1[(dxt1sel >> ((0 * 8) + 0)) & 3]; dst32[(width * 0) + 7] = colors1[(dxt1sel >> ((0 * 8) + 0)) & 3];
#ifdef CHECK #ifdef CHECK
assert(memcmp(&(tmp0[0]), &dst32[(width * 0)], 16) == 0); ASSERT(memcmp(&(tmp0[0]), &dst32[(width * 0)], 16) == 0);
assert(memcmp(&(tmp1[0]), &dst32[(width * 0) + 4], 16) == 0); ASSERT(memcmp(&(tmp1[0]), &dst32[(width * 0) + 4], 16) == 0);
#endif #endif
// Row 1: // Row 1:
dst32[(width * 1) + 0] = colors0[(dxt0sel >> ((1 * 8) + 6)) & 3]; dst32[(width * 1) + 0] = colors0[(dxt0sel >> ((1 * 8) + 6)) & 3];
@ -1375,8 +1379,8 @@ static void TexDecoder_DecodeImpl_CMPR(u32* dst, const u8* src, int width, int h
dst32[(width * 1) + 6] = colors1[(dxt1sel >> ((1 * 8) + 2)) & 3]; dst32[(width * 1) + 6] = colors1[(dxt1sel >> ((1 * 8) + 2)) & 3];
dst32[(width * 1) + 7] = colors1[(dxt1sel >> ((1 * 8) + 0)) & 3]; dst32[(width * 1) + 7] = colors1[(dxt1sel >> ((1 * 8) + 0)) & 3];
#ifdef CHECK #ifdef CHECK
assert(memcmp(&(tmp0[1]), &dst32[(width * 1)], 16) == 0); ASSERT(memcmp(&(tmp0[1]), &dst32[(width * 1)], 16) == 0);
assert(memcmp(&(tmp1[1]), &dst32[(width * 1) + 4], 16) == 0); ASSERT(memcmp(&(tmp1[1]), &dst32[(width * 1) + 4], 16) == 0);
#endif #endif
// Row 2: // Row 2:
dst32[(width * 2) + 0] = colors0[(dxt0sel >> ((2 * 8) + 6)) & 3]; dst32[(width * 2) + 0] = colors0[(dxt0sel >> ((2 * 8) + 6)) & 3];
@ -1388,8 +1392,8 @@ static void TexDecoder_DecodeImpl_CMPR(u32* dst, const u8* src, int width, int h
dst32[(width * 2) + 6] = colors1[(dxt1sel >> ((2 * 8) + 2)) & 3]; dst32[(width * 2) + 6] = colors1[(dxt1sel >> ((2 * 8) + 2)) & 3];
dst32[(width * 2) + 7] = colors1[(dxt1sel >> ((2 * 8) + 0)) & 3]; dst32[(width * 2) + 7] = colors1[(dxt1sel >> ((2 * 8) + 0)) & 3];
#ifdef CHECK #ifdef CHECK
assert(memcmp(&(tmp0[2]), &dst32[(width * 2)], 16) == 0); ASSERT(memcmp(&(tmp0[2]), &dst32[(width * 2)], 16) == 0);
assert(memcmp(&(tmp1[2]), &dst32[(width * 2) + 4], 16) == 0); ASSERT(memcmp(&(tmp1[2]), &dst32[(width * 2) + 4], 16) == 0);
#endif #endif
// Row 3: // Row 3:
dst32[(width * 3) + 0] = colors0[(dxt0sel >> ((3 * 8) + 6)) & 3]; dst32[(width * 3) + 0] = colors0[(dxt0sel >> ((3 * 8) + 6)) & 3];
@ -1401,8 +1405,8 @@ static void TexDecoder_DecodeImpl_CMPR(u32* dst, const u8* src, int width, int h
dst32[(width * 3) + 6] = colors1[(dxt1sel >> ((3 * 8) + 2)) & 3]; dst32[(width * 3) + 6] = colors1[(dxt1sel >> ((3 * 8) + 2)) & 3];
dst32[(width * 3) + 7] = colors1[(dxt1sel >> ((3 * 8) + 0)) & 3]; dst32[(width * 3) + 7] = colors1[(dxt1sel >> ((3 * 8) + 0)) & 3];
#ifdef CHECK #ifdef CHECK
assert(memcmp(&(tmp0[3]), &dst32[(width * 3)], 16) == 0); ASSERT(memcmp(&(tmp0[3]), &dst32[(width * 3)], 16) == 0);
assert(memcmp(&(tmp1[3]), &dst32[(width * 3) + 4], 16) == 0); ASSERT(memcmp(&(tmp1[3]), &dst32[(width * 3) + 4], 16) == 0);
#endif #endif
} }
} }