1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 04:02:42 +01:00

C-style cast cleanup III

This commit is contained in:
Nekotekina 2019-11-30 02:11:28 +03:00
parent ad9c9f0183
commit 28eacc616a
18 changed files with 143 additions and 94 deletions

View File

@ -252,6 +252,11 @@ void asmjit::build_transaction_abort(asmjit::X86Assembler& c, unsigned char code
#ifdef _MSC_VER
#pragma warning(push, 0)
#else
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wall"
#pragma GCC diagnostic ignored "-Wextra"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#endif
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/FormattedStream.h"
@ -261,6 +266,8 @@ void asmjit::build_transaction_abort(asmjit::X86Assembler& c, unsigned char code
#include "llvm/ExecutionEngine/ObjectCache.h"
#ifdef _MSC_VER
#pragma warning(pop)
#else
#pragma GCC diagnostic pop
#endif
#ifdef _WIN32

View File

@ -1,9 +1,22 @@
#pragma once
// Include asmjit with warnings ignored
#define ASMJIT_EMBED
#define ASMJIT_DEBUG
#ifdef _MSC_VER
#pragma warning(push, 0)
#include <asmjit/asmjit.h>
#pragma warning(pop)
#else
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wall"
#pragma GCC diagnostic ignored "-Wextra"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#include <asmjit/asmjit.h>
#pragma GCC diagnostic pop
#endif
#include <array>
#include <functional>
@ -100,12 +113,19 @@ FT build_function_asm(F&& builder)
#include "restore_new.h"
#ifdef _MSC_VER
#pragma warning(push, 0)
#else
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wall"
#pragma GCC diagnostic ignored "-Wextra"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#endif
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/ExecutionEngine/ExecutionEngine.h"
#ifdef _MSC_VER
#pragma warning(pop)
#else
#pragma GCC diagnostic pop
#endif
#include "define_new_memleakdetect.h"

View File

@ -140,12 +140,12 @@ namespace utils
// other after this
if (other.start > end)
{
return (s32)(other.start - end - 1);
return static_cast<s32>(other.start - end - 1);
}
// this after other
AUDIT(start > other.end);
return -((s32)(start - other.end - 1));
return -static_cast<s32>(start - other.end - 1);
}
u32 distance(const address_range &other) const
@ -577,7 +577,8 @@ namespace utils
} // namespace utils
namespace std {
namespace std
{
static_assert(sizeof(size_t) >= 2 * sizeof(u32), "size_t must be at least twice the size of u32");
template <>

View File

@ -114,7 +114,7 @@ struct size2_base
template<typename NT>
constexpr operator size2_base<NT>() const
{
return{ (NT)width, (NT)height };
return{ static_cast<NT>(width), static_cast<NT>(height) };
}
};
@ -142,11 +142,11 @@ struct position1_base
template<typename RhsT>
position1_base operator *(RhsT rhs) const
{
return{ T(x * rhs) };
return{ static_cast<T>(x * rhs) };
}
position1_base operator *(const position1_base& rhs) const
{
return{ T(x * rhs.x) };
return{ static_cast<T>(x * rhs.x) };
}
template<typename RhsT>
position1_base operator /(RhsT rhs) const
@ -225,7 +225,7 @@ struct position1_base
template<typename NT>
operator position1_base<NT>() const
{
return{ (NT)x };
return{ static_cast<NT>(x) };
}
double distance(const position1_base& to)
@ -303,11 +303,11 @@ struct position2_base
template<typename RhsT>
constexpr position2_base operator *(RhsT rhs) const
{
return{ T(x * rhs), T(y * rhs) };
return{ static_cast<T>(x * rhs), static_cast<T>(y * rhs) };
}
constexpr position2_base operator *(const position2_base& rhs) const
{
return{ T(x * rhs.x), T(y * rhs.y) };
return{ static_cast<T>(x * rhs.x), static_cast<T>(y * rhs.y) };
}
template<typename RhsT>
constexpr position2_base operator /(RhsT rhs) const
@ -398,12 +398,12 @@ struct position2_base
template<typename NT>
constexpr operator position2_base<NT>() const
{
return{ (NT)x, (NT)y };
return{ static_cast<NT>(x), static_cast<NT>(y) };
}
double distance(const position2_base& to) const
{
return std::sqrt(double((x - to.x) * (x - to.x) + (y - to.y) * (y - to.y)));
return std::sqrt((x - to.x) * (x - to.x) + (y - to.y) * (y - to.y));
}
};
@ -490,7 +490,7 @@ struct position3_base
template<typename NT>
operator position3_base<NT>() const
{
return{ (NT)x, (NT)y, (NT)z };
return{ static_cast<NT>(x), static_cast<NT>(y), static_cast<NT>(z) };
}
};
@ -580,7 +580,7 @@ struct position4_base
template<typename NT>
constexpr operator position4_base<NT>() const
{
return{ (NT)x, (NT)y, (NT)z, (NT)w };
return{ static_cast<NT>(x), static_cast<NT>(y), static_cast<NT>(z), static_cast<NT>(w) };
}
};
@ -652,7 +652,7 @@ struct coord_base
template<typename NT>
constexpr operator coord_base<NT>() const
{
return{ (NT)x, (NT)y, (NT)width, (NT)height };
return{ static_cast<NT>(x), static_cast<NT>(y), static_cast<NT>(width), static_cast<NT>(height) };
}
};
@ -755,13 +755,13 @@ struct area_base
}
constexpr area_base operator * (const f32& value) const
{
return{ (T)(x1 * value), (T)(y1 * value), (T)(x2 * value), (T)(y2 * value) };
return{ static_cast<T>(x1 * value), static_cast<T>(y1 * value), static_cast<T>(x2 * value), static_cast<T>(y2 * value) };
}
template<typename NT>
constexpr operator area_base<NT>() const
{
return{ (NT)x1, (NT)y1, (NT)x2, (NT)y2 };
return{ static_cast<NT>(x1), static_cast<NT>(y1), static_cast<NT>(x2), static_cast<NT>(y2) };
}
};
@ -824,7 +824,7 @@ struct coord3_base
template<typename NT>
constexpr operator coord3_base<NT>() const
{
return{ (NT)x, (NT)y, (NT)z, (NT)width, (NT)height, (NT)depth };
return{ static_cast<NT>(x), static_cast<NT>(y), static_cast<NT>(z), static_cast<NT>(width), static_cast<NT>(height), static_cast<NT>(depth) };
}
};
@ -877,7 +877,7 @@ struct color4_base
template<typename NT>
constexpr operator color4_base<NT>() const
{
return{ (NT)x, (NT)y, (NT)z, (NT)w };
return{ static_cast<NT>(x), static_cast<NT>(y), static_cast<NT>(z), static_cast<NT>(w) };
}
};
@ -920,7 +920,7 @@ struct color3_base
template<typename NT>
constexpr operator color3_base<NT>() const
{
return{ (NT)x, (NT)y, (NT)z };
return{ static_cast<NT>(x), static_cast<NT>(y), static_cast<NT>(z) };
}
};
@ -962,7 +962,7 @@ struct color2_base
template<typename NT>
constexpr operator color2_base<NT>() const
{
return{ (NT)x, (NT)y };
return{ static_cast<NT>(x), static_cast<NT>(y) };
}
};
@ -993,7 +993,7 @@ struct color1_base
template<typename NT>
constexpr operator color1_base<NT>() const
{
return{ (NT)x };
return{ static_cast<NT>(x) };
}
};

View File

@ -5,6 +5,11 @@
#include "restore_new.h"
#ifdef _MSC_VER
#pragma warning(push, 0)
#else
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wall"
#pragma GCC diagnostic ignored "-Wextra"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#endif
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/IRBuilder.h"
@ -13,6 +18,8 @@
#include "llvm/Analysis/ConstantFolding.h"
#ifdef _MSC_VER
#pragma warning(pop)
#else
#pragma GCC diagnostic pop
#endif
#include "define_new_memleakdetect.h"

View File

@ -19,6 +19,11 @@
#include "restore_new.h"
#ifdef _MSC_VER
#pragma warning(push, 0)
#else
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wall"
#pragma GCC diagnostic ignored "-Wextra"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#endif
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/MemoryBuffer.h"
@ -44,6 +49,8 @@
#include "llvm/Transforms/Vectorize.h"
#ifdef _MSC_VER
#pragma warning(pop)
#else
#pragma GCC diagnostic pop
#endif
#include "define_new_memleakdetect.h"

View File

@ -3187,6 +3187,15 @@ void spu_recompiler_base::dump(const spu_program& result, std::string& out)
#ifdef LLVM_AVAILABLE
#include "Emu/CPU/CPUTranslator.h"
#ifdef _MSC_VER
#pragma warning(push, 0)
#else
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wall"
#pragma GCC diagnostic ignored "-Wextra"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#endif
#include "llvm/ADT/Triple.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/IR/Verifier.h"
@ -3196,6 +3205,11 @@ void spu_recompiler_base::dump(const spu_program& result, std::string& out)
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/Vectorize.h"
#ifdef _MSC_VER
#pragma warning(pop)
#else
#pragma GCC diagnostic pop
#endif
class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator
{

View File

@ -433,7 +433,7 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64
render->display_buffers[id].pitch = pitch;
render->display_buffers[id].offset = offset;
render->display_buffers_count = std::max((u32)id + 1, render->display_buffers_count);
render->display_buffers_count = std::max<u32>(id + 1, render->display_buffers_count);
}
break;
@ -536,7 +536,7 @@ error_code sys_rsx_context_attribute(u32 context_id, u32 package_id, u64 a3, u64
// we only ever use head 1 for now
driverInfo.head[1].flipFlags |= 0x80000000;
driverInfo.head[1].lastFlipTime = rsxTimeStamp(); // should rsxthread set this?
driverInfo.head[1].flipBufferId = (u32)a3;
driverInfo.head[1].flipBufferId = static_cast<u32>(a3);
// seems gcmSysWaitLabel uses this offset, so lets set it to 0 every flip
vm::_ref<u32>(render->label_addr + 0x10) = 0;

View File

@ -532,8 +532,8 @@ public:
alignas(16) f32 tmp[4];
for (size_t offset_in_fragment_program : I->second.FragmentConstantOffsetCache)
{
char* data = (char*)fragment_program.addr + (u32)offset_in_fragment_program;
const __m128i vector = _mm_loadu_si128((__m128i*)data);
char* data = static_cast<char*>(fragment_program.addr) + offset_in_fragment_program;
const __m128i vector = _mm_loadu_si128(reinterpret_cast<__m128i*>(data));
const __m128i shuffled_vector = _mm_or_si128(_mm_slli_epi16(vector, 8), _mm_srli_epi16(vector, 8));
if (!patch_table.is_empty())

View File

@ -74,7 +74,7 @@ namespace rsx
vertex(int x, int y, int z, int w)
{
vec4((f32)x, (f32)y, (f32)z, (f32)w);
vec4(static_cast<f32>(x), static_cast<f32>(y), static_cast<f32>(z), static_cast<f32>(w));
}
float& operator[](int index)
@ -165,7 +165,7 @@ namespace rsx
return f.get();
}
fonts.push_back(std::make_unique<font>(name, (f32)size));
fonts.push_back(std::make_unique<font>(name, static_cast<f32>(size)));
return fonts.back().get();
}
@ -209,12 +209,12 @@ namespace rsx
std::vector<u8> bytes;
fs::file f(filename);
f.read(bytes, f.size());
data = stbi_load_from_memory(bytes.data(), (s32)f.size(), &w, &h, &bpp, STBI_rgb_alpha);
data = stbi_load_from_memory(bytes.data(), ::narrow<int>(f.size()), &w, &h, &bpp, STBI_rgb_alpha);
}
image_info(const std::vector<u8>& bytes)
{
data = stbi_load_from_memory(bytes.data(), (s32)bytes.size(), &w, &h, &bpp, STBI_rgb_alpha);
data = stbi_load_from_memory(bytes.data(), ::narrow<int>(bytes.size()), &w, &h, &bpp, STBI_rgb_alpha);
}
~image_info()
@ -505,8 +505,8 @@ namespace rsx
virtual void translate(s16 _x, s16 _y)
{
x = (u16)(x + _x);
y = (u16)(y + _y);
x = static_cast<u16>(x + _x);
y = static_cast<u16>(y + _y);
is_compiled = false;
}
@ -515,12 +515,12 @@ namespace rsx
{
if (origin_scaling)
{
x = (u16)(_x * x);
y = (u16)(_y * y);
x = static_cast<u16>(_x * x);
y = static_cast<u16>(_y * y);
}
w = (u16)(_x * w);
h = (u16)(_y * h);
w = static_cast<u16>(_x * w);
h = static_cast<u16>(_y * h);
is_compiled = false;
}
@ -626,7 +626,7 @@ namespace rsx
// Apply transform.
// (0, 0) has text sitting one line off the top left corner (text is outside the rect) hence the offset by text height
v.values[0] += x + padding_left;
v.values[1] += y + padding_top + (f32)renderer->size_px;
v.values[1] += y + padding_top + static_cast<f32>(renderer->size_px);
}
if (alignment == center)
@ -711,7 +711,7 @@ namespace rsx
cmd_text.config.set_font(font_ref ? font_ref : fontmgr::get("Arial", 12));
cmd_text.config.color = fore_color;
cmd_text.verts = render_text(text.c_str(), (f32)x, (f32)y);
cmd_text.verts = render_text(text.c_str(), static_cast<f32>(x), static_cast<f32>(y));
if (!cmd_text.verts.empty())
compiled_resources.add(std::move(compiled_resources_temp), margin_left, margin_top);
@ -737,13 +737,13 @@ namespace rsx
f32 unused = 0.f;
f32 max_w = 0.f;
f32 last_word = 0.f;
height = (u16)renderer->size_px;
height = static_cast<u16>(renderer->size_px);
for (auto c : text)
{
if (c == '\n')
{
height += (u16)renderer->size_px + 2;
height += static_cast<u16>(renderer->size_px + 2);
max_w = std::max(max_w, text_width);
text_width = 0.f;
last_word = 0.f;
@ -755,7 +755,7 @@ namespace rsx
last_word = text_width;
}
if (u8(c) > renderer->char_count)
if (static_cast<u8>(c) > renderer->char_count)
{
// Non-existent glyph
text_width += renderer->em_size;
@ -771,13 +771,13 @@ namespace rsx
{
max_w = std::max(max_w, last_word);
text_width -= (last_word + renderer->em_size);
height += (u16)renderer->size_px + 2;
height += static_cast<u16>(renderer->size_px + 2);
}
}
}
max_w = std::max(max_w, text_width);
width = (u16)ceilf(max_w);
width = static_cast<u16>(ceilf(max_w));
}
};
@ -817,8 +817,8 @@ namespace rsx
void set_pos(u16 _x, u16 _y) override
{
s16 dx = (s16)(_x - x);
s16 dy = (s16)(_y - y);
s16 dx = static_cast<s16>(_x - x);
s16 dy = static_cast<s16>(_y - y);
translate(dx, dy);
}
@ -877,12 +877,12 @@ namespace rsx
if (!is_compiled)
{
compiled_resource result = overlay_element::get_compiled();
const f32 global_y_offset = (f32)-scroll_offset_value;
const f32 global_y_offset = static_cast<f32>(-scroll_offset_value);
for (auto &item : m_items)
{
const s32 item_y_limit = (s32)(item->y + item->h) - scroll_offset_value - y;
const s32 item_y_base = (s32)item->y - scroll_offset_value - y;
const s32 item_y_limit = s32{item->y} + item->h - scroll_offset_value - y;
const s32 item_y_base = s32{item->y} - scroll_offset_value - y;
if (item_y_limit < 0 || item_y_base > h)
{
@ -892,7 +892,7 @@ namespace rsx
else if (item_y_limit > h || item_y_base < 0)
{
// Partial render
areaf clip_rect = { (f32)x, (f32)y, (f32)(x + w), (f32)(y + h) };
areaf clip_rect = areai{ x, y, (x + w), (y + h) };
result.add(item->get_compiled(), 0.f, global_y_offset, clip_rect);
}
else
@ -951,12 +951,12 @@ namespace rsx
if (!is_compiled)
{
compiled_resource result = overlay_element::get_compiled();
const f32 global_x_offset = (f32)-scroll_offset_value;
const f32 global_x_offset = static_cast<f32>(-scroll_offset_value);
for (auto &item : m_items)
{
const s32 item_x_limit = (s32)(item->x + item->w) - scroll_offset_value - w;
const s32 item_x_base = (s32)item->x - scroll_offset_value - w;
const s32 item_x_limit = s32{item->x} + item->w - scroll_offset_value - w;
const s32 item_x_base = s32{item->x} - scroll_offset_value - w;
if (item_x_limit < 0 || item_x_base > h)
{
@ -966,7 +966,7 @@ namespace rsx
else if (item_x_limit > h || item_x_base < 0)
{
// Partial render
areaf clip_rect = { (f32)x, (f32)y, (f32)(x + w), (f32)(y + h) };
areaf clip_rect = areai{ x, y, (x + w), (y + h) };
result.add(item->get_compiled(), global_x_offset, 0.f, clip_rect);
}
else

View File

@ -246,18 +246,18 @@ struct RSXFragmentProgram
rsx::texture_dimension_extended get_texture_dimension(u8 id) const
{
return (rsx::texture_dimension_extended)((texture_dimensions >> (id * 2)) & 0x3);
return rsx::texture_dimension_extended{static_cast<u8>((texture_dimensions >> (id * 2)) & 0x3)};
}
bool texcoord_is_2d(u8 index) const
{
return bool(texcoord_control_mask & (1u << index));
return !!(texcoord_control_mask & (1u << index));
}
bool texcoord_is_point_coord(u8 index) const
{
index += 16;
return bool(texcoord_control_mask & (1u << index));
return !!(texcoord_control_mask & (1u << index));
}
RSXFragmentProgram()

View File

@ -245,6 +245,6 @@ struct RSXVertexProgram
rsx::texture_dimension_extended get_texture_dimension(u8 id) const
{
return (rsx::texture_dimension_extended)((texture_dimensions >> (id * 2)) & 0x3);
return rsx::texture_dimension_extended{static_cast<u8>((texture_dimensions >> (id * 2)) & 0x3)};
}
};

View File

@ -564,7 +564,7 @@ namespace rsx
entries.push_back(tmp);
}
if ((entry_count = (u32)entries.size()) <= 2)
if ((entry_count = ::size32(entries)) <= 2)
return;
root.rewind();
@ -611,7 +611,7 @@ namespace rsx
}
f.read<u8>(bytes, f.size());
auto entry = unpack(*(pipeline_data*)bytes.data());
auto entry = unpack(*reinterpret_cast<pipeline_data*>(bytes.data()));
m_storage.preload_programs(std::get<1>(entry), std::get<2>(entry));
unpacked.push_back(entry);
@ -780,7 +780,7 @@ namespace rsx
RSXFragmentProgram fp = {};
fragment_program_data[program_hash] = data;
fp.addr = fragment_program_data[program_hash].data();
fp.ucode_length = (u32)data.size();
fp.ucode_length = ::size32(data);
return fp;
}
@ -849,7 +849,7 @@ namespace rsx
{
for (auto &address : vp.jump_table)
{
data_block.vp_jump_table[index++] = (u16)address;
data_block.vp_jump_table[index++] = static_cast<u16>(address);
}
}
else

View File

@ -286,7 +286,7 @@ namespace rsx
return 1u;
}
u32 count = (u32)draw_command_ranges.size();
u32 count = ::size32(draw_command_ranges);
if (draw_command_ranges.back().count == 0)
{
// Dangling barrier
@ -400,7 +400,7 @@ namespace rsx
const u32 count = barrier.address - previous_barrier;
ret.push_back({ 0, vertex_counter, count });
previous_barrier = (u32)barrier.address;
previous_barrier = barrier.address;
vertex_counter += count;
}

View File

@ -291,7 +291,7 @@ namespace rsx
{
for (u32 i = 0; i < size; i++)
{
*((Td*)dst + i) = *((Ts*)src - i);
*(static_cast<Td*>(dst) + i) = *(static_cast<Ts*>(src) - i);
}
}
@ -463,14 +463,14 @@ namespace rsx
* TODO: Variable src/dst and optional se conversion
*/
template <typename T>
void shuffle_texel_data_wzyx(void *data, u16 row_pitch_in_bytes, u16 row_length_in_texels, u16 num_rows)
void shuffle_texel_data_wzyx(void* data, u16 row_pitch_in_bytes, u16 row_length_in_texels, u16 num_rows)
{
char *raw_src = (char*)data;
char* raw_src = static_cast<char*>(data);
T tmp[4];
for (u16 n = 0; n < num_rows; ++n)
{
T* src = (T*)raw_src;
T* src = reinterpret_cast<T*>(raw_src);
raw_src += row_pitch_in_bytes;
for (u16 m = 0; m < row_length_in_texels; ++m)
@ -511,7 +511,7 @@ namespace rsx
else
width = parent_width;
x = (T)0;
x = static_cast<T>(0);
}
else
{
@ -531,7 +531,7 @@ namespace rsx
else
height = parent_height;
y = (T)0;
y = static_cast<T>(0);
}
else
{
@ -581,7 +581,7 @@ namespace rsx
static inline const f32 get_resolution_scale()
{
return g_cfg.video.strict_rendering_mode? 1.f : ((f32)g_cfg.video.resolution_scale_percent / 100.f);
return g_cfg.video.strict_rendering_mode? 1.f : (g_cfg.video.resolution_scale_percent / 100.f);
}
static inline const int get_resolution_scale_percent()
@ -598,9 +598,9 @@ namespace rsx
return value;
else if (clamp)
return (u16)std::max((get_resolution_scale_percent() * value) / 100, 1);
return static_cast<u16>(std::max((get_resolution_scale_percent() * value) / 100, 1));
else
return (get_resolution_scale_percent() * value) / 100;
return static_cast<u16>((get_resolution_scale_percent() * value) / 100);
}
static inline const u16 apply_inverse_resolution_scale(u16 value, bool clamp)
@ -608,9 +608,9 @@ namespace rsx
u16 result = value;
if (clamp)
result = (u16)std::max((value * 100) / get_resolution_scale_percent(), 1);
result = static_cast<u16>(std::max((value * 100) / get_resolution_scale_percent(), 1));
else
result = (value * 100) / get_resolution_scale_percent();
result = static_cast<u16>((value * 100) / get_resolution_scale_percent());
if (result <= g_cfg.video.min_scalable_dimension)
return value;
@ -721,14 +721,14 @@ namespace rsx
// before actually attempting to translate to the internal address. Seen happening heavily in R&C games
static inline u32 get_vertex_offset_from_base(u32 vert_data_base_offset, u32 vert_base_offset)
{
return ((u64)vert_data_base_offset + vert_base_offset) & 0xFFFFFFF;
return (vert_data_base_offset + vert_base_offset) & 0xFFFFFFF;
}
// Similar to vertex_offset_base calculation, the rsx internally adds and masks index
// before using
static inline u32 get_index_from_base(u32 index, u32 index_base)
{
return ((u64)index + index_base) & 0x000FFFFF;
return (index + index_base) & 0x000FFFFF;
}
// Convert color write mask for G8B8 to R8G8
@ -912,7 +912,7 @@ namespace rsx
_size = other._size;
const auto size_bytes = sizeof(Ty) * _capacity;
_data = (Ty*)malloc(size_bytes);
_data = static_cast<Ty*>(malloc(size_bytes));
std::memcpy(_data, other._data, size_bytes);
}
@ -943,15 +943,7 @@ namespace rsx
if (_capacity >= size)
return;
if (_data)
{
verify("realloc() failed!" HERE), _data = (Ty*)realloc(_data, sizeof(Ty) * size);
}
else
{
verify("malloc() failed!" HERE), _data = (Ty*)malloc(sizeof(Ty) * size);
}
verify("realloc() failed!" HERE), _data = static_cast<Ty*>(std::realloc(_data, sizeof(Ty) * size));
_capacity = size;
}

View File

@ -91,7 +91,7 @@ struct push_buffer_vertex_info
case vertex_base_type::s32k:
return size / 2;
default:
fmt::throw_exception("Unsupported vertex base type %d", (u8)type);
fmt::throw_exception("Unsupported vertex base type %d", static_cast<u8>(type));
}
}
@ -112,8 +112,8 @@ struct push_buffer_vertex_info
attribute_mask |= element_mask;
void* dst = data.data() + ((vertex_count - 1) * vertex_size) + sub_index;
*(u32*)dst = arg;
u32* dst = data.data() + ((vertex_count - 1) * vertex_size) + sub_index;
*dst = arg;
}
};

View File

@ -13,6 +13,7 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wall"
#pragma GCC diagnostic ignored "-Wextra"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#include <stb_image.h>
#pragma GCC diagnostic pop

View File

@ -365,7 +365,7 @@ struct atomic_storage<T, 2> : atomic_storage<T, 0>
static inline bool bts(T& dest, uint bit)
{
bool result;
ushort _bit = (ushort)bit;
ushort _bit = static_cast<ushort>(bit);
__asm__("lock btsw %2, %0\n" "setc %1" : "+m" (dest), "=r" (result) : "Ir" (_bit) : "cc");
return result;
}
@ -373,7 +373,7 @@ struct atomic_storage<T, 2> : atomic_storage<T, 0>
static inline bool btr(T& dest, uint bit)
{
bool result;
ushort _bit = (ushort)bit;
ushort _bit = static_cast<ushort>(bit);
__asm__("lock btrw %2, %0\n" "setc %1" : "+m" (dest), "=r" (result) : "Ir" (_bit) : "cc");
return result;
}
@ -381,7 +381,7 @@ struct atomic_storage<T, 2> : atomic_storage<T, 0>
static inline bool btc(T& dest, uint bit)
{
bool result;
ushort _bit = (ushort)bit;
ushort _bit = static_cast<ushort>(bit);
__asm__("lock btcw %2, %0\n" "setc %1" : "+m" (dest), "=r" (result) : "Ir" (_bit) : "cc");
return result;
}