STRG: Convert file-scope std::vector to std::array

Eliminates a runtime-static constructor and heap allocation at program
start.
This commit is contained in:
Lioncash 2020-03-31 14:15:06 -04:00
parent 16c37abf79
commit 96fa7af8b5
1 changed files with 6 additions and 2 deletions

View File

@ -1,10 +1,14 @@
#include "STRG.hpp"
#include <array>
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1 {
const std::vector<FourCC> skLanguages = {FOURCC('ENGL'), FOURCC('FREN'), FOURCC('GERM'), FOURCC('SPAN'),
FOURCC('ITAL'), FOURCC('DUTC'), FOURCC('JAPN')};
constexpr std::array skLanguages{
FOURCC('ENGL'), FOURCC('FREN'), FOURCC('GERM'), FOURCC('SPAN'), FOURCC('ITAL'), FOURCC('DUTC'), FOURCC('JAPN'),
};
static uint32_t ParseTag(const char16_t* str) {
char parseStr[9];