mirror of
https://github.com/PabloMK7/citra.git
synced 2025-09-12 13:50:03 +00:00
General: Remove usages of ARRAY_SIZE where applicable. (#5392)
Same behavior, but without our own boilerplate function.
This commit is contained in:
parent
f7aaa37bf2
commit
8ce81b19be
10 changed files with 35 additions and 29 deletions
|
@ -675,7 +675,7 @@ std::u16string Module::GetUsername() {
|
|||
|
||||
// the username string in the block isn't null-terminated,
|
||||
// so we need to find the end manually.
|
||||
std::u16string username(block.username, ARRAY_SIZE(block.username));
|
||||
std::u16string username(block.username, std::size(block.username));
|
||||
const std::size_t pos = username.find(u'\0');
|
||||
if (pos != std::u16string::npos)
|
||||
username.erase(pos);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <array>
|
||||
#include <cstring>
|
||||
#include "common/archives.h"
|
||||
#include "common/common_funcs.h"
|
||||
|
@ -29,12 +30,12 @@ void Y2R_U::serialize(Archive& ar, const unsigned int) {
|
|||
ar& spacial_dithering_enabled;
|
||||
}
|
||||
|
||||
static const CoefficientSet standard_coefficients[4] = {
|
||||
constexpr std::array<CoefficientSet, 4> standard_coefficients{{
|
||||
{{0x100, 0x166, 0xB6, 0x58, 0x1C5, -0x166F, 0x10EE, -0x1C5B}}, // ITU_Rec601
|
||||
{{0x100, 0x193, 0x77, 0x2F, 0x1DB, -0x1933, 0xA7C, -0x1D51}}, // ITU_Rec709
|
||||
{{0x12A, 0x198, 0xD0, 0x64, 0x204, -0x1BDE, 0x10F2, -0x229B}}, // ITU_Rec601_Scaling
|
||||
{{0x12A, 0x1CA, 0x88, 0x36, 0x21C, -0x1F04, 0x99C, -0x2421}}, // ITU_Rec709_Scaling
|
||||
};
|
||||
}};
|
||||
|
||||
ResultCode ConversionConfiguration::SetInputLineWidth(u16 width) {
|
||||
if (width == 0 || width > 1024 || width % 8 != 0) {
|
||||
|
@ -66,8 +67,8 @@ ResultCode ConversionConfiguration::SetInputLines(u16 lines) {
|
|||
|
||||
ResultCode ConversionConfiguration::SetStandardCoefficient(
|
||||
StandardCoefficient standard_coefficient) {
|
||||
std::size_t index = static_cast<std::size_t>(standard_coefficient);
|
||||
if (index >= ARRAY_SIZE(standard_coefficients)) {
|
||||
const auto index = static_cast<std::size_t>(standard_coefficient);
|
||||
if (index >= standard_coefficients.size()) {
|
||||
return ResultCode(ErrorDescription::InvalidEnumValue, ErrorModule::CAM,
|
||||
ErrorSummary::InvalidArgument, ErrorLevel::Usage); // 0xE0E053ED
|
||||
}
|
||||
|
@ -457,9 +458,9 @@ void Y2R_U::SetStandardCoefficient(Kernel::HLERequestContext& ctx) {
|
|||
|
||||
void Y2R_U::GetStandardCoefficient(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx, 0x21, 1, 0);
|
||||
u32 index = rp.Pop<u32>();
|
||||
const u32 index = rp.Pop<u32>();
|
||||
|
||||
if (index < ARRAY_SIZE(standard_coefficients)) {
|
||||
if (index < standard_coefficients.size()) {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.PushRaw(standard_coefficients[index]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue