From 5abe7c1386bfd75e300a08193442b03ac8b00b47 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Sun, 23 Mar 2025 16:35:36 +0000 Subject: [PATCH] Codechange: Use default initialisation for 32bpp_sse2's SpriteData. Avoids using memset. --- src/blitter/32bpp_sse2.cpp | 3 +-- src/blitter/32bpp_sse2.hpp | 12 ++++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/blitter/32bpp_sse2.cpp b/src/blitter/32bpp_sse2.cpp index 5defef274f..919e119f37 100644 --- a/src/blitter/32bpp_sse2.cpp +++ b/src/blitter/32bpp_sse2.cpp @@ -35,8 +35,7 @@ Sprite *Blitter_32bppSSE_Base::Encode(const SpriteLoader::SpriteCollection &spri } /* Calculate sizes and allocate. */ - SpriteData sd; - memset(&sd, 0, sizeof(sd)); + SpriteData sd{}; uint all_sprites_size = 0; for (ZoomLevel z = zoom_min; z <= zoom_max; z++) { const SpriteLoader::Sprite *src_sprite = &sprite[z]; diff --git a/src/blitter/32bpp_sse2.hpp b/src/blitter/32bpp_sse2.hpp index 257395f9ba..7928513fb2 100644 --- a/src/blitter/32bpp_sse2.hpp +++ b/src/blitter/32bpp_sse2.hpp @@ -65,14 +65,14 @@ public: /** Data stored about a (single) sprite. */ struct SpriteInfo { - uint32_t sprite_offset; ///< The offset to the sprite data. - uint32_t mv_offset; ///< The offset to the map value data. - uint16_t sprite_line_size; ///< The size of a single line (pitch). - uint16_t sprite_width; ///< The width of the sprite. + uint32_t sprite_offset = 0; ///< The offset to the sprite data. + uint32_t mv_offset = 0; ///< The offset to the map value data. + uint16_t sprite_line_size = 0; ///< The size of a single line (pitch). + uint16_t sprite_width = 0; ///< The width of the sprite. }; struct SpriteData { - SpriteFlags flags; - SpriteInfo infos[ZOOM_LVL_END]; + SpriteFlags flags{}; + std::array infos{}; uint8_t data[]; ///< Data, all zoomlevels. };