GS: Using C++ array styles instead of C

This commit is contained in:
Correia 2024-04-24 20:07:10 -03:00
parent 9d7a973bb7
commit e78a23f7ed
2 changed files with 32 additions and 27 deletions

View File

@ -3,13 +3,13 @@
// all rights reserved to the project and its maintainers
namespace cosmic::gs {
const u8 blockTable32[4][8]{
ConstByteArray<8> blockTable32[4]{
{0, 1, 4, 5, 16, 17, 20, 21},
{2, 3, 6, 7, 18, 19, 22, 23},
{8, 9, 12, 13, 24, 25, 28, 29},
{10, 11, 14, 15, 26, 27, 30, 31}
};
const u8 blockTable16[8][4]{
ConstByteArray<4> blockTable16[8]{
{0, 2, 8, 10},
{1, 3, 9, 11},
{4, 6, 12, 14},
@ -19,7 +19,7 @@ namespace cosmic::gs {
{20, 22, 28, 30},
{21, 23, 29, 31}
};
const u8 blockTable16S[8][4]{
ConstByteArray<4> blockTable16S[8]{
{0, 2, 16, 18},
{1, 3, 17, 19},
{8, 10, 24, 26},
@ -29,13 +29,13 @@ namespace cosmic::gs {
{12, 14, 28, 30},
{13, 15, 29, 31}
};
const u8 blockTable8[4][8]{
ConstByteArray<8> blockTable8[4]{
{0, 1, 4, 5, 16, 17, 20, 21},
{2, 3, 6, 7, 18, 19, 22, 23},
{8, 9, 12, 13, 24, 25, 28, 29},
{10, 11, 14, 15, 26, 27, 30, 31}
};
const u8 blockTable4[8][4]{
ConstByteArray<4> blockTable4[8]{
{0, 2, 8, 10},
{1, 3, 9, 11},
{4, 6, 12, 14},
@ -45,7 +45,7 @@ namespace cosmic::gs {
{20, 22, 28, 30},
{21, 23, 29, 31}
};
const u8 columnTable32[8][8]{
ConstByteArray<8> columnTable32[8]{
{0, 1, 4, 5, 8, 9, 12, 13},
{2, 3, 6, 7, 10, 11, 14, 15},
{16, 17, 20, 21, 24, 25, 28, 29},
@ -55,7 +55,7 @@ namespace cosmic::gs {
{48, 49, 52, 53, 56, 57, 60, 61},
{50, 51, 54, 55, 58, 59, 62, 63},
};
const u8 columnTable16[8][16]{
ConstByteArray<16> columnTable16[8]{
{0, 2, 8, 10, 16, 18, 24, 26,
1, 3, 9, 11, 17, 19, 25, 27},
{4, 6, 12, 14, 20, 22, 28, 30,
@ -73,7 +73,7 @@ namespace cosmic::gs {
{100, 102, 108, 110, 116, 118, 124, 126,
101, 103, 109, 111, 117, 119, 125, 127},
};
const u8 columnTable8[16][16]{
ConstByteArray<16> columnTable8[16]{
{0, 4, 16, 20, 32, 36, 48, 52,
2, 6, 18, 22, 34, 38, 50, 54},
{8, 12, 24, 28, 40, 44, 56, 60,
@ -107,7 +107,7 @@ namespace cosmic::gs {
{201, 205, 217, 221, 233, 237, 249, 253,
203, 207, 219, 223, 235, 239, 251, 255},
};
const u16 columnTable4[16][32]{
ConstWordArray<32> columnTable4[16]{
{0, 8, 32, 40, 64, 72, 96, 104,
2, 10, 34, 42, 66, 74, 98, 106,
4, 12, 36, 44, 68, 76, 100, 108,
@ -173,27 +173,27 @@ namespace cosmic::gs {
405, 413, 437, 445, 469, 477, 501, 509,
407, 415, 439, 447, 471, 479, 503, 511},
};
const u8 clutTableT32I8[128]{
ConstByteArray<128> clutTableT32I8{
0, 1, 4, 5, 8, 9, 12, 13, 2, 3, 6, 7, 10, 11, 14, 15,
64, 65, 68, 69, 72 , 73, 76, 77, 66, 67, 70, 71, 74, 75, 78, 79,
16, 17, 20, 21, 24, 25, 28, 29, 18, 19, 22, 23, 26, 27, 30, 31,
80, 81, 84, 85, 88, 89, 92, 93, 82, 83, 86, 87, 90, 91, 94, 95,
32, 33, 36, 37, 40, 41, 44, 45, 34, 35, 38, 39, 42, 43, 46, 47,
96, 97, 100, 101, 104, 105, 108, 109, 98, 99, 102, 103, 106, 107, 110, 111,
48, 49, 52, 53, 56, 57, 60, 61, 50, 51, 54, 55, 58, 59, 62, 63,
48, 49, 52, 53, 56, 57, 60, 61, 50, 51, 54, 55, 58, 59, 62, 63,
112, 113, 116, 117, 120, 121, 124, 125, 114, 115, 118, 119, 122, 123, 126, 127
};
const u8 clutTableT32I4[16]{
ConstByteArray<16> clutTableT32I4{
0, 1, 4, 5, 8, 9, 12, 13,
2, 3, 6, 7, 10, 11, 14, 15
};
const u8 clutTableT16I8[32]{
ConstByteArray<32> clutTableT16I8{
0, 2, 8, 10, 16, 18, 24, 26,
4, 6, 12, 14, 20, 22, 28, 30,
1, 3, 9, 11, 17, 19, 25, 27,
5, 7, 13, 15, 21, 23, 29, 31
};
const u8 clutTableT16I4[16]{
ConstByteArray<16> clutTableT16I4{
0, 2, 8, 10, 16, 18, 24, 26,
4, 6, 12, 14, 20, 22, 28, 30
};

View File

@ -5,20 +5,25 @@ namespace cosmic::gs {
// with the commit message stating, "They aren't just an offset of the base value
// like the color formats, but instead an XOR of the associated color format"
extern const u8 blockTable32[4][8];
extern const u8 blockTable16[8][4];
extern const u8 blockTable16S[8][4];
extern const u8 blockTable8[4][8];
extern const u8 blockTable4[8][4];
template <size_t S>
using ConstByteArray = const std::array<u8, S>;
template <size_t S>
using ConstWordArray = const std::array<u16, S>;
extern const u8 columnTable32[8][8];
extern const u8 columnTable16[8][16];
extern const u8 columnTable8[16][16];
extern const u16 columnTable4[16][32];
extern ConstByteArray<8> blockTable32[4];
extern ConstByteArray<4> blockTable16[8];
extern ConstByteArray<4> blockTable16S[8];
extern ConstByteArray<8> blockTable8[4];
extern ConstByteArray<4> blockTable4[8];
extern const u8 clutTableT32I8[128];
extern const u8 clutTableT32I4[16];
extern const u8 clutTableT16I8[32];
extern const u8 clutTableT16I4[16];
extern ConstByteArray<8> columnTable32[8];
extern ConstByteArray<16> columnTable16[8];
extern ConstByteArray<16> columnTable8[16];
extern ConstWordArray<32> columnTable4[16];
extern ConstByteArray<128> clutTableT32I8;
extern ConstByteArray<16> clutTableT32I4;
extern ConstByteArray<32> clutTableT16I8;
extern ConstByteArray<16> clutTableT16I4;
}