4 #include "test_global.h"
6 // Partially initialized array
7 int ArrayInitPartial[10] = { 60, 70, 80, 90, 100 };
8 int ArrayInitFull[] = { 10, 20, 30, 40, 50 };
9 const int ArrayConst[] = { -10, -20, -30 };
10 static double ArrayDouble[10] = { 0.5, 1.5, 2.5, 3.5 };
14 { (uint8_t *)(a), sizeof(a) }
17 uint8_t *ArrayAddress;
18 size_t ArraySizeInBytes;
20 ARRAY(ArrayInitPartial),
25 size_t NumArraysElements = sizeof(Arrays) / sizeof(*Arrays);
28 size_t getNumArrays() {
30 // return NumArraysElements;
33 const uint8_t *getArray(size_t WhichArray, size_t &Len) {
34 // Using a switch statement instead of a table lookup because such a
35 // table is represented as a kind of initializer that Subzero
36 // doesn't yet support. Specifically, the table becomes constant
37 // aggregate data, and it contains relocations. TODO(stichnot):
38 // switch over to the cleaner table-based method when global
39 // initializers are fully implemented.
45 Len = sizeof(ArrayInitPartial);
46 return (uint8_t *)&ArrayInitPartial;
48 Len = sizeof(ArrayInitFull);
49 return (uint8_t *)&ArrayInitFull;
51 Len = sizeof(ArrayConst);
52 return (uint8_t *)&ArrayConst;
54 Len = sizeof(ArrayDouble);
55 return (uint8_t *)&ArrayDouble;
58 if (WhichArray >= NumArraysElements) {
62 Len = Arrays[WhichArray].ArraySizeInBytes;
63 return Arrays[WhichArray].ArrayAddress;