Inline variables to have compiler reuse them

Unfortunately, this requires at least C++17, but the inline is exactly
what we need to avoid redundant copies of static const data.

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2023-11-08 18:48:31 +01:00
parent 4fb684ce75
commit 9d50a878dc
3 changed files with 5 additions and 5 deletions

View File

@ -15,14 +15,14 @@
namespace stdex namespace stdex
{ {
/// \cond internal /// \cond internal
const char base64_enc_lookup[64] = { inline const char base64_enc_lookup[64] = {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'
}; };
const uint8_t base64_dec_lookup[256] = { inline const uint8_t base64_dec_lookup[256] = {
/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
/* 0 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, /* 0 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
/* 1 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, /* 1 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,

View File

@ -13,7 +13,7 @@ namespace stdex
wchar_t unicode[3]; ///< Unicode string representation wchar_t unicode[3]; ///< Unicode string representation
}; };
const sgml_unicode_pair sgml_unicode[] = { inline const sgml_unicode_pair sgml_unicode[] = {
{ "AElig", L"\u00c6" }, { "AElig", L"\u00c6" },
{ "Aacgr", L"\u0386" }, { "Aacgr", L"\u0386" },
{ "Aacute", L"\u00c1" }, { "Aacute", L"\u00c1" },
@ -1551,7 +1551,7 @@ namespace stdex
{ "zwnj", L"\u200c" }, { "zwnj", L"\u200c" },
}; };
const size_t unicode_sgml[] = { inline const size_t unicode_sgml[] = {
0x5b6, 0x5b6,
0x48d, 0x48d,
0x30d, 0x30d,

View File

@ -48,7 +48,7 @@ namespace stdex
/// ///
/// System information /// System information
/// ///
const struct sys_info_t inline const struct sys_info_t
{ {
/// ///
/// The platform this process was compiled for /// The platform this process was compiled for