diff options
| author | 2022-05-29 02:33:24 -0700 | |
|---|---|---|
| committer | 2022-05-29 02:33:24 -0700 | |
| commit | 1c8b509441c63e14b05729ac9f38af89c20f5fe3 (patch) | |
| tree | 02f6de35ec91c4f7d9749f6e791d136103c1c8f8 | |
| parent | Merge pull request #8339 from Docteh/about_icon (diff) | |
| parent | time_zone_manager: Use s8 for month length tables (diff) | |
| download | yuzu-1c8b509441c63e14b05729ac9f38af89c20f5fe3.tar.gz yuzu-1c8b509441c63e14b05729ac9f38af89c20f5fe3.tar.xz yuzu-1c8b509441c63e14b05729ac9f38af89c20f5fe3.zip | |
Merge pull request #8332 from Morph1984/reduce_exec_size
general: Use smaller array types where applicable
| -rw-r--r-- | src/audio_core/command_generator.cpp | 16 | ||||
| -rw-r--r-- | src/core/hle/service/time/time_zone_manager.cpp | 7 | ||||
| -rw-r--r-- | src/video_core/command_classes/codecs/vp9.cpp | 8 | ||||
| -rw-r--r-- | src/video_core/surface.h | 6 |
4 files changed, 18 insertions, 19 deletions
diff --git a/src/audio_core/command_generator.cpp b/src/audio_core/command_generator.cpp index ae4efafb6..ff20ed00f 100644 --- a/src/audio_core/command_generator.cpp +++ b/src/audio_core/command_generator.cpp | |||
| @@ -129,17 +129,17 @@ s32 ToS32(float sample) { | |||
| 129 | return static_cast<s32>(rescaled_sample); | 129 | return static_cast<s32>(rescaled_sample); |
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | constexpr std::array<std::size_t, 20> REVERB_TAP_INDEX_1CH{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 132 | constexpr std::array<u8, 20> REVERB_TAP_INDEX_1CH{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 133 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; | 133 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| 134 | 134 | ||
| 135 | constexpr std::array<std::size_t, 20> REVERB_TAP_INDEX_2CH{0, 0, 0, 1, 1, 1, 1, 0, 0, 0, | 135 | constexpr std::array<u8, 20> REVERB_TAP_INDEX_2CH{0, 0, 0, 1, 1, 1, 1, 0, 0, 0, |
| 136 | 1, 1, 1, 0, 0, 0, 0, 1, 1, 1}; | 136 | 1, 1, 1, 0, 0, 0, 0, 1, 1, 1}; |
| 137 | 137 | ||
| 138 | constexpr std::array<std::size_t, 20> REVERB_TAP_INDEX_4CH{0, 0, 0, 1, 1, 1, 1, 2, 2, 2, | 138 | constexpr std::array<u8, 20> REVERB_TAP_INDEX_4CH{0, 0, 0, 1, 1, 1, 1, 2, 2, 2, |
| 139 | 1, 1, 1, 0, 0, 0, 0, 3, 3, 3}; | 139 | 1, 1, 1, 0, 0, 0, 0, 3, 3, 3}; |
| 140 | 140 | ||
| 141 | constexpr std::array<std::size_t, 20> REVERB_TAP_INDEX_6CH{4, 0, 0, 1, 1, 1, 1, 2, 2, 2, | 141 | constexpr std::array<u8, 20> REVERB_TAP_INDEX_6CH{4, 0, 0, 1, 1, 1, 1, 2, 2, 2, |
| 142 | 1, 1, 1, 0, 0, 0, 0, 3, 3, 3}; | 142 | 1, 1, 1, 0, 0, 0, 0, 3, 3, 3}; |
| 143 | 143 | ||
| 144 | template <std::size_t CHANNEL_COUNT> | 144 | template <std::size_t CHANNEL_COUNT> |
| 145 | void ApplyReverbGeneric( | 145 | void ApplyReverbGeneric( |
diff --git a/src/core/hle/service/time/time_zone_manager.cpp b/src/core/hle/service/time/time_zone_manager.cpp index 449a5ac96..eeec34436 100644 --- a/src/core/hle/service/time/time_zone_manager.cpp +++ b/src/core/hle/service/time/time_zone_manager.cpp | |||
| @@ -110,10 +110,9 @@ static constexpr s64 GetLeapDaysFromYear(s64 year) { | |||
| 110 | } | 110 | } |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | static constexpr int GetMonthLength(bool is_leap_year, int month) { | 113 | static constexpr s8 GetMonthLength(bool is_leap_year, int month) { |
| 114 | constexpr std::array<int, 12> month_lengths{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; | 114 | constexpr std::array<s8, 12> month_lengths{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; |
| 115 | constexpr std::array<int, 12> month_lengths_leap{31, 29, 31, 30, 31, 30, | 115 | constexpr std::array<s8, 12> month_lengths_leap{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; |
| 116 | 31, 31, 30, 31, 30, 31}; | ||
| 117 | return is_leap_year ? month_lengths_leap[month] : month_lengths[month]; | 116 | return is_leap_year ? month_lengths_leap[month] : month_lengths[month]; |
| 118 | } | 117 | } |
| 119 | 118 | ||
diff --git a/src/video_core/command_classes/codecs/vp9.cpp b/src/video_core/command_classes/codecs/vp9.cpp index a95618913..c01431441 100644 --- a/src/video_core/command_classes/codecs/vp9.cpp +++ b/src/video_core/command_classes/codecs/vp9.cpp | |||
| @@ -153,7 +153,7 @@ constexpr Vp9EntropyProbs default_probs{ | |||
| 153 | .high_precision{128, 128}, | 153 | .high_precision{128, 128}, |
| 154 | }; | 154 | }; |
| 155 | 155 | ||
| 156 | constexpr std::array<s32, 256> norm_lut{ | 156 | constexpr std::array<u8, 256> norm_lut{ |
| 157 | 0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, | 157 | 0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, |
| 158 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 158 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 159 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 159 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| @@ -164,7 +164,7 @@ constexpr std::array<s32, 256> norm_lut{ | |||
| 164 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 164 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 165 | }; | 165 | }; |
| 166 | 166 | ||
| 167 | constexpr std::array<s32, 254> map_lut{ | 167 | constexpr std::array<u8, 254> map_lut{ |
| 168 | 20, 21, 22, 23, 24, 25, 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, | 168 | 20, 21, 22, 23, 24, 25, 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, |
| 169 | 1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 2, 50, 51, 52, 53, 54, | 169 | 1, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 2, 50, 51, 52, 53, 54, |
| 170 | 55, 56, 57, 58, 59, 60, 61, 3, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, | 170 | 55, 56, 57, 58, 59, 60, 61, 3, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, |
| @@ -232,7 +232,7 @@ constexpr std::array<s32, 254> map_lut{ | |||
| 232 | std::max(0, RecenterNonNeg(0xff - 1 - new_prob, 0xff - 1 - old_prob) - 1)); | 232 | std::max(0, RecenterNonNeg(0xff - 1 - new_prob, 0xff - 1 - old_prob) - 1)); |
| 233 | } | 233 | } |
| 234 | 234 | ||
| 235 | return map_lut[index]; | 235 | return static_cast<s32>(map_lut[index]); |
| 236 | } | 236 | } |
| 237 | } // Anonymous namespace | 237 | } // Anonymous namespace |
| 238 | 238 | ||
| @@ -819,7 +819,7 @@ void VpxRangeEncoder::Write(bool bit, s32 probability) { | |||
| 819 | local_range = range - split; | 819 | local_range = range - split; |
| 820 | } | 820 | } |
| 821 | 821 | ||
| 822 | s32 shift = norm_lut[local_range]; | 822 | s32 shift = static_cast<s32>(norm_lut[local_range]); |
| 823 | local_range <<= shift; | 823 | local_range <<= shift; |
| 824 | count += shift; | 824 | count += shift; |
| 825 | 825 | ||
diff --git a/src/video_core/surface.h b/src/video_core/surface.h index 86fea61ae..75e055592 100644 --- a/src/video_core/surface.h +++ b/src/video_core/surface.h | |||
| @@ -147,7 +147,7 @@ enum class SurfaceTarget { | |||
| 147 | TextureCubeArray, | 147 | TextureCubeArray, |
| 148 | }; | 148 | }; |
| 149 | 149 | ||
| 150 | constexpr std::array<u32, MaxPixelFormat> BLOCK_WIDTH_TABLE = {{ | 150 | constexpr std::array<u8, MaxPixelFormat> BLOCK_WIDTH_TABLE = {{ |
| 151 | 1, // A8B8G8R8_UNORM | 151 | 1, // A8B8G8R8_UNORM |
| 152 | 1, // A8B8G8R8_SNORM | 152 | 1, // A8B8G8R8_SNORM |
| 153 | 1, // A8B8G8R8_SINT | 153 | 1, // A8B8G8R8_SINT |
| @@ -249,7 +249,7 @@ constexpr u32 DefaultBlockWidth(PixelFormat format) { | |||
| 249 | return BLOCK_WIDTH_TABLE[static_cast<std::size_t>(format)]; | 249 | return BLOCK_WIDTH_TABLE[static_cast<std::size_t>(format)]; |
| 250 | } | 250 | } |
| 251 | 251 | ||
| 252 | constexpr std::array<u32, MaxPixelFormat> BLOCK_HEIGHT_TABLE = {{ | 252 | constexpr std::array<u8, MaxPixelFormat> BLOCK_HEIGHT_TABLE = {{ |
| 253 | 1, // A8B8G8R8_UNORM | 253 | 1, // A8B8G8R8_UNORM |
| 254 | 1, // A8B8G8R8_SNORM | 254 | 1, // A8B8G8R8_SNORM |
| 255 | 1, // A8B8G8R8_SINT | 255 | 1, // A8B8G8R8_SINT |
| @@ -351,7 +351,7 @@ constexpr u32 DefaultBlockHeight(PixelFormat format) { | |||
| 351 | return BLOCK_HEIGHT_TABLE[static_cast<std::size_t>(format)]; | 351 | return BLOCK_HEIGHT_TABLE[static_cast<std::size_t>(format)]; |
| 352 | } | 352 | } |
| 353 | 353 | ||
| 354 | constexpr std::array<u32, MaxPixelFormat> BITS_PER_BLOCK_TABLE = {{ | 354 | constexpr std::array<u8, MaxPixelFormat> BITS_PER_BLOCK_TABLE = {{ |
| 355 | 32, // A8B8G8R8_UNORM | 355 | 32, // A8B8G8R8_UNORM |
| 356 | 32, // A8B8G8R8_SNORM | 356 | 32, // A8B8G8R8_SNORM |
| 357 | 32, // A8B8G8R8_SINT | 357 | 32, // A8B8G8R8_SINT |