From 2c8b0cb0c37d5fe4c5f85f5a6b17d72eca5f918d Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Sat, 15 Jun 2024 12:37:36 +0100 Subject: [PATCH] blit_impl.hpp: Fix incorrect assumption Turns out we can have fills of length 1 --- Source/engine/render/blit_impl.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/engine/render/blit_impl.hpp b/Source/engine/render/blit_impl.hpp index 3da8e0594..ab6a91b49 100644 --- a/Source/engine/render/blit_impl.hpp +++ b/Source/engine/render/blit_impl.hpp @@ -18,7 +18,7 @@ namespace devilution { DVL_ALWAYS_INLINE DVL_ATTRIBUTE_HOT void BlitFillDirect(uint8_t *dst, unsigned length, uint8_t color) { - DVL_ASSUME(length >= 2); + DVL_ASSUME(length != 0); std::memset(dst, color, length); } @@ -41,7 +41,7 @@ struct BlitDirect { DVL_ALWAYS_INLINE DVL_ATTRIBUTE_HOT void BlitFillWithMap(uint8_t *dst, unsigned length, uint8_t color, const uint8_t *DVL_RESTRICT colorMap) { - DVL_ASSUME(length >= 2); + DVL_ASSUME(length != 0); std::memset(dst, colorMap[color], length); } @@ -53,7 +53,7 @@ DVL_ALWAYS_INLINE DVL_ATTRIBUTE_HOT void BlitPixelsWithMap(uint8_t *DVL_RESTRICT DVL_ALWAYS_INLINE DVL_ATTRIBUTE_HOT void BlitFillBlended(uint8_t *dst, unsigned length, uint8_t color) { - DVL_ASSUME(length >= 2); + DVL_ASSUME(length != 0); std::for_each(DEVILUTIONX_BLIT_EXECUTION_POLICY dst, dst + length, [tbl = paletteTransparencyLookup[color]](uint8_t &dstColor) { dstColor = tbl[dstColor]; });