File: structreturn_test.c

package info (click to toggle)
golang-github-ebitengine-purego 0.9.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 844 kB
  • sloc: asm: 10,607; ansic: 631; cpp: 8; makefile: 3
file content (238 lines) | stat: -rw-r--r-- 4,190 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2024 The Ebitengine Authors

#include <stdint.h>

struct Empty{};

struct Empty ReturnEmpty() {
    struct Empty e = {};
    return e;
}

struct StructInStruct{
    struct{ int16_t a; } a;
    struct{ int16_t b; } b;
    struct{ int16_t c; } c;
};

struct StructInStruct ReturnStructInStruct(int16_t a, int16_t b, int16_t c) {
    struct StructInStruct e = {{a}, {b}, {c}};
    return e;
}

struct ThreeShorts{
    int16_t a, b, c;
};

struct ThreeShorts ReturnThreeShorts(int16_t a, int16_t b, int16_t c) {
    struct ThreeShorts e = {a, b, c};
    return e;
}

struct FourShorts{
    int16_t a, b, c, d;
};

struct FourShorts ReturnFourShorts(int16_t a, int16_t b, int16_t c, int16_t d) {
    struct FourShorts e = {a, b, c, d};
    return e;
}

struct OneLong{
    int64_t a;
};

struct OneLong ReturnOneLong(int64_t a) {
    struct OneLong e = {a};
    return e;
}

struct TwoLongs{
    int64_t a, b;
};

struct TwoLongs ReturnTwoLongs(int64_t a, int64_t b) {
    struct TwoLongs e = {a, b};
    return e;
}

struct ThreeLongs{
    int64_t a, b, c;
};

struct ThreeLongs ReturnThreeLongs(int64_t a, int64_t b, int64_t c) {
    struct ThreeLongs e = {a, b, c};
    return e;
}

struct OneFloat{
    float a;
};

struct TwoFloats{
    float a, b;
};

struct TwoFloats ReturnTwoFloats(float a, float b) {
    struct TwoFloats e = {a-b, a*b};
    return e;
}

struct ThreeFloats{
    float a, b, c;
};

struct ThreeFloats ReturnThreeFloats(float a, float b, float c) {
    struct ThreeFloats e = {a, b, c};
    return e;
}

struct OneFloat ReturnOneFloat(float a) {
    struct OneFloat e = {a};
    return e;
}

struct OneDouble{
    double a;
};

struct OneDouble ReturnOneDouble(double a) {
    struct OneDouble e = {a};
    return e;
}

struct TwoDoubles{
    double a, b;
};

struct TwoDoubles ReturnTwoDoubles(double a, double b) {
    struct TwoDoubles e = {a, b};
    return e;
}

struct ThreeDoubles{
    double a, b, c;
};

struct ThreeDoubles ReturnThreeDoubles(double a, double b, double c) {
    struct ThreeDoubles e = {a, b, c};
    return e;
}

struct FourDoubles{
    double a, b, c, d;
};

struct FourDoubles ReturnFourDoubles(double a, double b, double c, double d) {
    struct FourDoubles e = {a, b, c, d};
    return e;
}

struct FourDoublesInternal{
    struct {
        double a, b;
    } f;
    struct {
        double c, d;
    } g;
};

struct FourDoublesInternal ReturnFourDoublesInternal(double a, double b, double c, double d) {
    struct FourDoublesInternal e = { {a, b}, {c, d} };
    return e;
}

struct FiveDoubles{
    double a, b, c, d, e;
};

struct FiveDoubles ReturnFiveDoubles(double a, double b, double c, double d, double e) {
    struct FiveDoubles s = {a, b, c, d, e};
    return s;
}

struct OneFloatOneDouble{
    float a;
    double b;
};

struct OneFloatOneDouble ReturnOneFloatOneDouble(float a, double b) {
    struct OneFloatOneDouble e = {a, b};
    return e;
}

struct OneDoubleOneFloat{
    double a;
    float b;
};

struct OneDoubleOneFloat ReturnOneDoubleOneFloat(double a, float b) {
    struct OneDoubleOneFloat e = {a, b};
    return e;
}

struct Unaligned1{
    int8_t  a;
    int16_t b;
    int64_t c;
};

struct Unaligned1 ReturnUnaligned1(int8_t a, int16_t b, int64_t c) {
    struct Unaligned1 e = {a, b, c};
    return e;
}

struct Mixed1{
     float a;
     int32_t b;
};

struct Mixed1 ReturnMixed1(float a, int32_t b) {
    struct Mixed1 e = {a, b};
    return e;
}

struct Mixed2{
     float a;
     int32_t b;
     float c;
     int32_t d;
};

struct Mixed2 ReturnMixed2(float a, int32_t b, float c, int32_t d) {
    struct Mixed2 e = {a, b, c, d};
    return e;
}

struct Mixed3{
     float a;
     uint32_t b;
     double c;
};

struct Mixed3 ReturnMixed3(float a, uint32_t b, double c) {
    struct Mixed3 s = {a, b, c};
    return s;
}

struct Mixed4{
     double a;
     uint32_t b;
     float c;
};

struct Mixed4 ReturnMixed4(double a, uint32_t b, float c) {
    struct Mixed4 s = {a, b, c};
    return s;
}

struct Ptr1{
     int64_t *a;
     void *b;
};

struct Ptr1 ReturnPtr1(int64_t *a, void *b) {
    struct Ptr1 s = {a, b};
    return s;
}