blob: 42ae52005b2da2bc26c609b94b542b8bb0af5c3b [file] [log] [blame]
// GENERATED FILE - DO NOT EDIT.
// Generated by gen_builtin_symbols.py using data from builtin_variables.json and
// builtin_function_declarations.txt.
//
// Copyright 2019 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// ImmutableString_ESSL_autogen.cpp: Wrapper for static or pool allocated char arrays, that are
// guaranteed to be valid and unchanged for the duration of the compilation. Implements
// mangledNameHash using perfect hash function from gen_builtin_symbols.py
#include "compiler/translator/ImmutableString.h"
std::ostream &operator<<(std::ostream &os, const sh::ImmutableString &str)
{
return os.write(str.data(), str.length());
}
#if defined(_MSC_VER)
#pragma warning(disable : 4309) // truncation of constant value
#endif
namespace
{
constexpr int mangledkT1[] = {179, 465, 780, 37, 427, 988, 839, 569, 1032, 221,
251, 467, 1589, 703, 528, 1241, 1408, 255, 1521, 1362,
620, 967, 982, 1547, 1602, 1192, 277, 1199, 294, 822,
265, 167, 1299, 1659, 1357, 205, 530};
constexpr int mangledkT2[] = {329, 825, 1399, 348, 282, 1332, 1006, 1217, 826, 518,
1610, 399, 1114, 534, 22, 873, 1193, 1375, 859, 17,
546, 1240, 208, 558, 123, 1357, 861, 60, 341, 939,
181, 1606, 1280, 498, 336, 1172, 198};
constexpr int mangledkG[] = {
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, 694, 0, 1577, 738,
0, 1483, 0, 0, 0, 0, 0, 0, 0, 560, 0, 724, 0, 0, 0, 0,
1654, 1576, 0, 0, 41, 0, 1405, 126, 1034, 0, 376, 0, 987, 0, 0, 45,
562, 1287, 0, 0, 1305, 0, 0, 177, 0, 0, 0, 997, 0, 351, 0, 1427,
0, 0, 344, 0, 0, 0, 0, 1476, 0, 0, 1537, 194, 0, 0, 0, 0,
10, 0, 0, 0, 0, 1531, 0, 0, 1415, 0, 0, 0, 0, 0, 144, 0,
0, 0, 1104, 0, 1497, 0, 0, 0, 1222, 976, 0, 33, 1602, 1097, 929, 0,
951, 626, 0, 0, 0, 0, 259, 0, 0, 0, 357, 0, 880, 0, 1452, 0,
753, 0, 0, 0, 0, 0, 0, 0, 1295, 1486, 24, 0, 629, 0, 714, 491,
0, 523, 0, 555, 1127, 37, 0, 0, 0, 0, 0, 544, 174, 0, 396, 1031,
0, 543, 1629, 374, 0, 593, 0, 0, 0, 0, 0, 0, 0, 1183, 0, 0,
0, 260, 582, 0, 0, 0, 1651, 0, 0, 0, 645, 0, 273, 0, 583, 0,
1576, 544, 1610, 1549, 0, 0, 692, 1293, 0, 294, 0, 1483, 0, 1663, 0, 1520,
0, 0, 624, 0, 1511, 482, 699, 34, 1263, 43, 768, 869, 857, 0, 0, 183,
0, 1417, 546, 152, 0, 0, 0, 0, 598, 0, 0, 1628, 0, 329, 0, 0,
530, 1258, 556, 774, 1608, 0, 590, 0, 0, 0, 1435, 0, 542, 0, 1574, 0,
0, 51, 0, 0, 493, 377, 1228, 0, 0, 921, 0, 0, 0, 0, 1463, 721,
0, 0, 0, 1478, 1633, 0, 0, 1115, 1348, 165, 0, 171, 0, 0, 0, 194,
0, 0, 0, 167, 0, 0, 533, 194, 1162, 0, 0, 1192, 0, 972, 405, 401,
268, 0, 784, 1226, 0, 1275, 0, 561, 0, 0, 0, 385, 0, 541, 1175, 243,
136, 241, 1021, 0, 315, 0, 359, 151, 331, 0, 37, 0, 1060, 0, 105, 0,
0, 310, 0, 0, 0, 0, 0, 0, 0, 596, 0, 0, 0, 791, 0, 836,
0, 904, 81, 1155, 744, 0, 173, 0, 0, 0, 0, 0, 0, 84, 907, 577,
0, 0, 0, 464, 0, 25, 689, 0, 0, 375, 0, 0, 0, 0, 0, 1115,
415, 369, 1125, 527, 0, 0, 667, 495, 951, 1175, 0, 0, 0, 1045, 0, 0,
0, 159, 0, 899, 0, 0, 40, 915, 728, 1621, 125, 683, 669, 0, 63, 35,
934, 1015, 1084, 0, 0, 603, 364, 0, 169, 1264, 1552, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1410, 0, 522, 776, 0, 0, 947, 221, 1515, 1094, 1199, 645,
0, 37, 1611, 0, 454, 0, 0, 0, 0, 0, 0, 0, 187, 903, 1269, 1302,
528, 0, 395, 0, 0, 0, 0, 839, 815, 0, 1365, 0, 0, 1630, 1056, 0,
0, 0, 364, 0, 293, 1580, 0, 586, 0, 0, 1070, 820, 0, 0, 127, 81,
0, 0, 0, 0, 1588, 0, 1389, 1570, 1295, 0, 57, 0, 332, 1621, 0, 1238,
155, 0, 608, 0, 0, 0, 0, 493, 0, 0, 0, 198, 745, 825, 636, 0,
0, 0, 665, 0, 0, 661, 585, 1586, 0, 0, 1559, 0, 0, 649, 0, 1391,
0, 321, 0, 1636, 999, 1280, 902, 1592, 0, 0, 0, 0, 0, 0, 263, 1206,
0, 0, 1662, 1397, 26, 928, 0, 842, 1466, 1269, 648, 0, 935, 854, 0, 415,
1040, 0, 0, 25, 644, 0, 0, 0, 1183, 172, 1442, 0, 1345, 0, 474, 365,
139, 0, 1099, 120, 0, 0, 0, 0, 152, 834, 663, 925, 0, 0, 0, 0,
1283, 0, 0, 0, 0, 0, 1034, 227, 1146, 635, 898, 1029, 7, 721, 230, 280,
0, 1096, 0, 0, 776, 477, 0, 0, 386, 1100, 468, 0, 0, 405, 82, 520,
0, 630, 0, 0, 0, 628, 461, 531, 1241, 0, 1164, 1481, 318, 563, 0, 0,
916, 1503, 681, 208, 0, 736, 0, 0, 0, 459, 358, 1287, 0, 0, 1048, 1019,
0, 415, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 255, 0, 1593, 85,
1529, 952, 179, 1283, 21, 464, 0, 0, 196, 1288, 21, 1348, 0, 0, 449, 0,
1428, 1215, 1594, 0, 1541, 0, 0, 0, 0, 0, 0, 0, 20, 0, 436, 784,
0, 864, 0, 0, 0, 1370, 0, 71, 0, 0, 85, 777, 0, 1227, 1527, 997,
748, 1593, 1457, 283, 103, 770, 344, 0, 0, 1576, 0, 884, 0, 871, 656, 0,
244, 730, 123, 591, 0, 675, 217, 187, 1129, 792, 210, 208, 446, 0, 0, 810,
250, 1044, 0, 1198, 492, 0, 0, 1566, 0, 0, 0, 0, 0, 291, 0, 280,
142, 0, 0, 0, 766, 0, 648, 0, 0, 637, 0, 396, 0, 1495, 290, 561,
1442, 594, 1526, 0, 0, 0, 0, 1442, 0, 512, 0, 0, 0, 415, 0, 1658,
0, 754, 46, 1489, 463, 0, 889, 887, 1535, 0, 506, 336, 856, 0, 1550, 1435,
0, 227, 1646, 1095, 155, 1253, 0, 1496, 116, 0, 0, 0, 266, 0, 1022, 0,
0, 558, 0, 25, 418, 422, 965, 991, 33, 1588, 195, 234, 0, 0, 193, 0,
693, 0, 277, 0, 0, 0, 0, 0, 0, 193, 0, 0, 883, 363, 295, 0,
0, 642, 0, 204, 0, 0, 572, 634, 0, 0, 975, 704, 0, 1413, 1458, 809,
0, 963, 1387, 830, 1197, 1656, 0, 0, 1125, 1338, 18, 649, 540, 1474, 1618, 1475,
0, 1073, 0, 526, 0, 0, 0, 409, 0, 728, 0, 0, 0, 1081, 207, 465,
760, 0, 0, 0, 364, 396, 755, 0, 0, 0, 1387, 378, 1565, 557, 0, 0,
76, 0, 0, 938, 398, 381, 141, 630, 0, 1013, 733, 0, 522, 0, 0, 0,
0, 914, 0, 0, 1288, 0, 124, 644, 367, 727, 779, 0, 330, 345, 846, 1460,
881, 512, 0, 770, 0, 0, 0, 464, 1202, 0, 708, 0, 0, 0, 577, 922,
0, 71, 1316, 528, 496, 128, 0, 850, 0, 0, 294, 1426, 0, 0, 44, 623,
1062, 0, 0, 242, 0, 0, 1507, 0, 1542, 207, 0, 1353, 0, 0, 0, 1173,
364, 1666, 225, 0, 534, 1582, 586, 0, 699, 249, 0, 0, 99, 166, 1231, 0,
0, 236, 0, 983, 0, 354, 0, 0, 312, 0, 0, 139, 0, 0, 1523, 930,
0, 1026, 1017, 0, 0, 1599, 1644, 0, 0, 11, 218, 412, 0, 277, 64, 339,
1069, 115, 0, 843, 72, 331, 0, 1116, 993, 0, 222, 473, 0, 393, 77, 0,
10, 273, 1229, 1182, 0, 277, 0, 246, 732, 0, 0, 923, 0, 863, 760, 1202,
251, 676, 0, 0, 0, 778, 11, 0, 1642, 861, 227, 0, 477, 38, 1048, 1547,
1444, 857, 0, 1238, 221, 340, 190, 0, 1389, 130, 1041, 1232, 0, 903, 302, 716,
529, 1177, 1627, 84, 1591, 592, 520, 0, 0, 0, 62, 0, 180, 0, 0, 187,
0, 0, 0, 0, 1059, 1137, 0, 1483, 0, 705, 370, 0, 944, 1303, 804, 401,
489, 0, 1313, 1494, 652, 0, 0, 306, 308, 690, 909, 1006, 1249, 0, 199, 1116,
987, 905, 407, 0, 232, 393, 114, 1399, 0, 850, 148, 471, 513, 0, 615, 56,
409, 787, 4, 936, 0, 0, 1581, 0, 707, 0, 0, 0, 0, 0, 338, 684,
0, 280, 0, 0, 937, 917, 1065, 0, 0, 1474, 243, 141, 0, 1494, 554, 56,
0, 311, 480, 0, 718, 84, 0, 100, 878, 457, 1587, 1548, 0, 82, 1407, 886,
78, 65, 708, 272, 793, 0, 0, 0, 0, 540, 1664, 660, 895, 0, 0, 0,
466, 1501, 1452, 0, 0, 1258, 135, 0, 142, 1388, 94, 0, 0, 0, 0, 1640,
1200, 0, 568, 796, 1624, 0, 1513, 0, 0, 779, 499, 1197, 431, 0, 1344, 402,
591, 372, 1411, 0, 143, 0, 0, 1183, 0, 40, 739, 666, 96, 1400, 196, 0,
126, 207, 0, 298, 353, 1592, 314, 167, 467, 791, 838, 0, 962, 0, 39, 0,
550, 1480, 131, 242, 579, 0, 0, 446, 0, 513, 927, 0, 0, 587, 540, 1551,
1527, 1551, 0, 679, 877, 284, 0, 1025, 371, 0, 0, 0, 1080, 151, 1564, 979,
755, 0, 1491, 888, 1636, 32, 662, 606, 530, 795, 0, 0, 1376, 0, 926, 503,
553, 289, 0, 0, 0, 1281, 884, 1037, 1409, 0, 0, 1046, 757, 0, 1336, 107,
116, 0, 0, 285, 1288, 933, 1353, 0, 839, 926, 840, 514, 688, 1045, 678, 1084,
302, 508, 0, 1312, 0, 280, 0, 388, 404, 1517, 0, 0, 120, 786, 1157, 344,
1647, 1318, 484, 0, 763, 997, 417, 1435, 0, 516, 773, 0, 327, 55, 554, 1126,
931, 144, 1467, 1483, 627, 1338, 1618, 1444, 1402, 121, 46, 916, 0, 0, 1667, 0,
1620, 1114, 81, 445, 0, 0, 0, 1281, 0, 0, 609, 0, 240, 0, 0, 0,
1148, 1449, 283, 0, 0, 746, 1314, 368, 681, 0, 397, 792, 0, 80, 0, 1497,
76, 0, 0, 0, 0, 927, 0, 1187, 245, 1243, 1548, 215, 1066, 0, 1360, 47,
0, 41, 739, 822, 629, 497, 0, 1326, 278, 274, 133, 124, 0, 225, 190, 0,
0, 0, 153, 0, 654, 81, 0, 463, 0, 0, 868, 1033, 530, 769, 574, 0,
753, 0, 181, 105, 442, 1326, 0, 0, 0, 1124, 918, 0, 0, 864, 0, 740,
1454, 0, 0, 435, 0, 0, 604, 1651, 44, 279, 1181, 408, 140, 1511, 276, 874,
0, 0, 309, 0, 63, 0, 380, 586, 801, 1077, 1188, 150, 0, 406, 188, 0,
395, 17, 673, 0, 494, 306, 0, 1418, 1422, 0, 0, 0, 1057, 724, 16, 453,
0, 0, 0, 0, 0, 0, 791, 834, 490, 1489, 0, 1132, 973, 0, 0, 241,
501, 0, 644, 444, 657, 1381, 0, 670, 850, 0, 0, 0, 983, 0, 136, 672,
757, 561, 356, 0, 725, 0, 0, 1096, 129, 0, 0, 0, 595, 1288, 667, 0,
330, 1072, 1619, 0, 622, 855, 826, 921};
int MangledHashG(const char *key, const int *T)
{
int sum = 0;
for (int i = 0; key[i] != '\0'; i++)
{
sum += T[i] * key[i];
sum %= 1672;
}
return mangledkG[sum];
}
int MangledPerfectHash(const char *key)
{
if (strlen(key) > 37)
return 0;
return (MangledHashG(key, mangledkT1) + MangledHashG(key, mangledkT2)) % 1672;
}
constexpr int unmangledkT1[] = {277, 59, 31, 44, 197, 182, 56, 205, 196, 115, 78, 90, 14,
17, 268, 111, 200, 47, 166, 160, 180, 146, 157, 131, 29, 198};
constexpr int unmangledkT2[] = {65, 240, 118, 268, 65, 272, 67, 89, 124, 39, 161, 140, 164,
62, 37, 125, 263, 194, 237, 86, 191, 157, 254, 179, 95, 256};
constexpr int unmangledkG[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 84, 0, 0, 0, 0, 0, 0, 159, 181,
0, 158, 0, 0, 0, 52, 0, 0, 0, 0, 0, 0, 26, 111, 0, 0, 107, 0,
0, 0, 256, 64, 27, 0, 0, 0, 0, 3, 8, 63, 146, 0, 0, 0, 181, 166,
261, 0, 122, 0, 78, 0, 0, 24, 248, 211, 85, 0, 285, 0, 21, 191, 0, 8,
34, 0, 0, 0, 0, 0, 136, 0, 0, 46, 0, 32, 20, 0, 0, 236, 0, 0,
0, 0, 36, 0, 0, 193, 43, 0, 0, 0, 0, 102, 21, 88, 0, 0, 33, 0,
165, 143, 9, 0, 162, 88, 0, 10, 63, 73, 77, 0, 0, 0, 236, 84, 0, 0,
129, 0, 0, 9, 0, 0, 126, 0, 43, 0, 178, 0, 93, 0, 82, 267, 0, 0,
0, 0, 181, 252, 227, 0, 17, 130, 0, 54, 0, 0, 94, 51, 59, 0, 0, 0,
0, 38, 158, 48, 0, 0, 174, 18, 0, 0, 0, 76, 170, 38, 42, 0, 136, 284,
0, 194, 0, 0, 135, 252, 0, 0, 106, 0, 99, 140, 226, 0, 0, 66, 0, 205,
0, 0, 200, 0, 167, 77, 0, 0, 202, 0, 6, 98, 88, 193, 0, 30, 0, 57,
0, 0, 64, 0, 60, 78, 1, 119, 73, 69, 0, 223, 48, 0, 0, 42, 257, 142,
0, 264, 29, 4, 68, 285, 261, 0, 0, 19, 46, 112, 21, 14, 86, 0, 194, 77,
0, 0, 279, 0, 145, 0, 20, 286, 103, 70, 133, 63, 54, 246, 68, 25, 23, 53,
38, 0, 35, 95, 0, 70, 244, 0, 0, 225, 79, 284, 11, 0, 35, 0, 60};
int UnmangledHashG(const char *key, const int *T)
{
int sum = 0;
for (int i = 0; key[i] != '\0'; i++)
{
sum += T[i] * key[i];
sum %= 287;
}
return unmangledkG[sum];
}
int UnmangledPerfectHash(const char *key)
{
if (strlen(key) > 26)
return 0;
return (UnmangledHashG(key, unmangledkT1) + UnmangledHashG(key, unmangledkT2)) % 287;
}
}
namespace sh
{
template <>
const size_t ImmutableString::FowlerNollVoHash<4>::kFnvPrime = 16777619u;
template <>
const size_t ImmutableString::FowlerNollVoHash<4>::kFnvOffsetBasis = 0x811c9dc5u;
template <>
const size_t ImmutableString::FowlerNollVoHash<8>::kFnvPrime =
static_cast<size_t>(1099511628211ull);
template <>
const size_t ImmutableString::FowlerNollVoHash<8>::kFnvOffsetBasis =
static_cast<size_t>(0xcbf29ce484222325ull);
uint32_t ImmutableString::mangledNameHash() const
{
return MangledPerfectHash(data());
}
uint32_t ImmutableString::unmangledNameHash() const
{
return UnmangledPerfectHash(data());
}
} // namespace sh