1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: 2024 The Ebitengine Authors
3
4#include <stdint.h>
5
6struct Empty{};
7
8struct Empty ReturnEmpty() {
9 struct Empty e = {};
10 return e;
11}
12
13struct StructInStruct{
14 struct{ int16_t a; } a;
15 struct{ int16_t b; } b;
16 struct{ int16_t c; } c;
17};
18
19struct StructInStruct ReturnStructInStruct(int16_t a, int16_t b, int16_t c) {
20 struct StructInStruct e = {{a}, {b}, {c}};
21 return e;
22}
23
24struct ThreeShorts{
25 int16_t a, b, c;
26};
27
28struct ThreeShorts ReturnThreeShorts(int16_t a, int16_t b, int16_t c) {
29 struct ThreeShorts e = {a, b, c};
30 return e;
31}
32
33struct FourShorts{
34 int16_t a, b, c, d;
35};
36
37struct FourShorts ReturnFourShorts(int16_t a, int16_t b, int16_t c, int16_t d) {
38 struct FourShorts e = {a, b, c, d};
39 return e;
40}
41
42struct OneLong{
43 int64_t a;
44};
45
46struct OneLong ReturnOneLong(int64_t a) {
47 struct OneLong e = {a};
48 return e;
49}
50
51struct TwoLongs{
52 int64_t a, b;
53};
54
55struct TwoLongs ReturnTwoLongs(int64_t a, int64_t b) {
56 struct TwoLongs e = {a, b};
57 return e;
58}
59
60struct ThreeLongs{
61 int64_t a, b, c;
62};
63
64struct ThreeLongs ReturnThreeLongs(int64_t a, int64_t b, int64_t c) {
65 struct ThreeLongs e = {a, b, c};
66 return e;
67}
68
69struct OneFloat{
70 float a;
71};
72
73struct TwoFloats{
74 float a, b;
75};
76
77struct TwoFloats ReturnTwoFloats(float a, float b) {
78 struct TwoFloats e = {a-b, a*b};
79 return e;
80}
81
82struct ThreeFloats{
83 float a, b, c;
84};
85
86struct ThreeFloats ReturnThreeFloats(float a, float b, float c) {
87 struct ThreeFloats e = {a, b, c};
88 return e;
89}
90
91struct OneFloat ReturnOneFloat(float a) {
92 struct OneFloat e = {a};
93 return e;
94}
95
96struct OneDouble{
97 double a;
98};
99
100struct OneDouble ReturnOneDouble(double a) {
101 struct OneDouble e = {a};
102 return e;
103}
104
105struct TwoDoubles{
106 double a, b;
107};
108
109struct TwoDoubles ReturnTwoDoubles(double a, double b) {
110 struct TwoDoubles e = {a, b};
111 return e;
112}
113
114struct ThreeDoubles{
115 double a, b, c;
116};
117
118struct ThreeDoubles ReturnThreeDoubles(double a, double b, double c) {
119 struct ThreeDoubles e = {a, b, c};
120 return e;
121}
122
123struct FourDoubles{
124 double a, b, c, d;
125};
126
127struct FourDoubles ReturnFourDoubles(double a, double b, double c, double d) {
128 struct FourDoubles e = {a, b, c, d};
129 return e;
130}
131
132struct FiveDoubles{
133 double a, b, c, d, e;
134};
135
136struct FiveDoubles ReturnFiveDoubles(double a, double b, double c, double d, double e) {
137 struct FiveDoubles s = {a, b, c, d, e};
138 return s;
139}
140
141struct OneFloatOneDouble{
142 float a;
143 double b;
144};
145
146struct OneFloatOneDouble ReturnOneFloatOneDouble(float a, double b) {
147 struct OneFloatOneDouble e = {a, b};
148 return e;
149}
150
151struct OneDoubleOneFloat{
152 double a;
153 float b;
154};
155
156struct OneDoubleOneFloat ReturnOneDoubleOneFloat(double a, float b) {
157 struct OneDoubleOneFloat e = {a, b};
158 return e;
159}
160
161struct Unaligned1{
162 int8_t a;
163 int16_t b;
164 int64_t c;
165};
166
167struct Unaligned1 ReturnUnaligned1(int8_t a, int16_t b, int64_t c) {
168 struct Unaligned1 e = {a, b, c};
169 return e;
170}
171
172struct Mixed1{
173 float a;
174 int32_t b;
175};
176
177struct Mixed1 ReturnMixed1(float a, int32_t b) {
178 struct Mixed1 e = {a, b};
179 return e;
180}
181
182struct Mixed2{
183 float a;
184 int32_t b;
185 float c;
186 int32_t d;
187};
188
189struct Mixed2 ReturnMixed2(float a, int32_t b, float c, int32_t d) {
190 struct Mixed2 e = {a, b, c, d};
191 return e;
192}
193
194struct Mixed3{
195 float a;
196 uint32_t b;
197 double c;
198};
199
200struct Mixed3 ReturnMixed3(float a, uint32_t b, double c) {
201 struct Mixed3 s = {a, b, c};
202 return s;
203}
204
205struct Mixed4{
206 double a;
207 uint32_t b;
208 float c;
209};
210
211struct Mixed4 ReturnMixed4(double a, uint32_t b, float c) {
212 struct Mixed4 s = {a, b, c};
213 return s;
214}
215
216struct Ptr1{
217 int64_t *a;
218 void *b;
219};
220
221struct Ptr1 ReturnPtr1(int64_t *a, void *b) {
222 struct Ptr1 s = {a, b};
223 return s;
224}