-
Notifications
You must be signed in to change notification settings - Fork 5
/
swizzle.h
419 lines (407 loc) · 14.9 KB
/
swizzle.h
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
#pragma once
#include "cthing.h"
#include "math/vec.h"
#define CT_SWIZZLE_ID(d, c, b, a) (size_t)((d << 6) | (c << 4) | (b << 2) | a)
#define CT_SWIZZLE_A(id) ((id)&3)
#define CT_SWIZZLE_B(id) ((id >> 2) & 3)
#define CT_SWIZZLE_C(id) ((id >> 4) & 3)
#define CT_SWIZZLE_D(id) ((id >> 6) & 3)
#define X CT_SWIZZLE_ID(0, 0, 0, 0)
#define Y CT_SWIZZLE_ID(0, 0, 0, 1)
#define Z CT_SWIZZLE_ID(0, 0, 0, 2)
#define W CT_SWIZZLE_ID(0, 0, 0, 3)
#define XX CT_SWIZZLE_ID(0, 0, 0, 0)
#define XY CT_SWIZZLE_ID(0, 0, 0, 1)
#define XZ CT_SWIZZLE_ID(0, 0, 0, 2)
#define XW CT_SWIZZLE_ID(0, 0, 0, 3)
#define YX CT_SWIZZLE_ID(0, 0, 1, 0)
#define YY CT_SWIZZLE_ID(0, 0, 1, 1)
#define YZ CT_SWIZZLE_ID(0, 0, 1, 2)
#define YW CT_SWIZZLE_ID(0, 0, 1, 3)
#define ZX CT_SWIZZLE_ID(0, 0, 2, 0)
#define ZY CT_SWIZZLE_ID(0, 0, 2, 1)
#define ZZ CT_SWIZZLE_ID(0, 0, 2, 2)
#define ZW CT_SWIZZLE_ID(0, 0, 2, 3)
#define WX CT_SWIZZLE_ID(0, 0, 3, 0)
#define WY CT_SWIZZLE_ID(0, 0, 3, 1)
#define WZ CT_SWIZZLE_ID(0, 0, 3, 2)
#define WW CT_SWIZZLE_ID(0, 0, 3, 3)
#define XXX CT_SWIZZLE_ID(0, 0, 0, 0)
#define XXY CT_SWIZZLE_ID(0, 0, 0, 1)
#define XXZ CT_SWIZZLE_ID(0, 0, 0, 2)
#define XXW CT_SWIZZLE_ID(0, 0, 0, 3)
#define XYX CT_SWIZZLE_ID(0, 0, 1, 0)
#define XYY CT_SWIZZLE_ID(0, 0, 1, 1)
#define XYZ CT_SWIZZLE_ID(0, 0, 1, 2)
#define XYW CT_SWIZZLE_ID(0, 0, 1, 3)
#define XZX CT_SWIZZLE_ID(0, 0, 2, 0)
#define XZY CT_SWIZZLE_ID(0, 0, 2, 1)
#define XZZ CT_SWIZZLE_ID(0, 0, 2, 2)
#define XZW CT_SWIZZLE_ID(0, 0, 2, 3)
#define XWX CT_SWIZZLE_ID(0, 0, 3, 0)
#define XWY CT_SWIZZLE_ID(0, 0, 3, 1)
#define XWZ CT_SWIZZLE_ID(0, 0, 3, 2)
#define XWW CT_SWIZZLE_ID(0, 0, 3, 3)
#define YXX CT_SWIZZLE_ID(0, 1, 0, 0)
#define YXY CT_SWIZZLE_ID(0, 1, 0, 1)
#define YXZ CT_SWIZZLE_ID(0, 1, 0, 2)
#define YXW CT_SWIZZLE_ID(0, 1, 0, 3)
#define YYX CT_SWIZZLE_ID(0, 1, 1, 0)
#define YYY CT_SWIZZLE_ID(0, 1, 1, 1)
#define YYZ CT_SWIZZLE_ID(0, 1, 1, 2)
#define YYW CT_SWIZZLE_ID(0, 1, 1, 3)
#define YZX CT_SWIZZLE_ID(0, 1, 2, 0)
#define YZY CT_SWIZZLE_ID(0, 1, 2, 1)
#define YZZ CT_SWIZZLE_ID(0, 1, 2, 2)
#define YZW CT_SWIZZLE_ID(0, 1, 2, 3)
#define YWX CT_SWIZZLE_ID(0, 1, 3, 0)
#define YWY CT_SWIZZLE_ID(0, 1, 3, 1)
#define YWZ CT_SWIZZLE_ID(0, 1, 3, 2)
#define YWW CT_SWIZZLE_ID(0, 1, 3, 3)
#define ZXX CT_SWIZZLE_ID(0, 2, 0, 0)
#define ZXY CT_SWIZZLE_ID(0, 2, 0, 1)
#define ZXZ CT_SWIZZLE_ID(0, 2, 0, 2)
#define ZXW CT_SWIZZLE_ID(0, 2, 0, 3)
#define ZYX CT_SWIZZLE_ID(0, 2, 1, 0)
#define ZYY CT_SWIZZLE_ID(0, 2, 1, 1)
#define ZYZ CT_SWIZZLE_ID(0, 2, 1, 2)
#define ZYW CT_SWIZZLE_ID(0, 2, 1, 3)
#define ZZX CT_SWIZZLE_ID(0, 2, 2, 0)
#define ZZY CT_SWIZZLE_ID(0, 2, 2, 1)
#define ZZZ CT_SWIZZLE_ID(0, 2, 2, 2)
#define ZZW CT_SWIZZLE_ID(0, 2, 2, 3)
#define ZWX CT_SWIZZLE_ID(0, 2, 3, 0)
#define ZWY CT_SWIZZLE_ID(0, 2, 3, 1)
#define ZWZ CT_SWIZZLE_ID(0, 2, 3, 2)
#define ZWW CT_SWIZZLE_ID(0, 2, 3, 3)
#define WXX CT_SWIZZLE_ID(0, 3, 0, 0)
#define WXY CT_SWIZZLE_ID(0, 3, 0, 1)
#define WXZ CT_SWIZZLE_ID(0, 3, 0, 2)
#define WXW CT_SWIZZLE_ID(0, 3, 0, 3)
#define WYX CT_SWIZZLE_ID(0, 3, 1, 0)
#define WYY CT_SWIZZLE_ID(0, 3, 1, 1)
#define WYZ CT_SWIZZLE_ID(0, 3, 1, 2)
#define WYW CT_SWIZZLE_ID(0, 3, 1, 3)
#define WZX CT_SWIZZLE_ID(0, 3, 2, 0)
#define WZY CT_SWIZZLE_ID(0, 3, 2, 1)
#define WZZ CT_SWIZZLE_ID(0, 3, 2, 2)
#define WZW CT_SWIZZLE_ID(0, 3, 2, 3)
#define WWX CT_SWIZZLE_ID(0, 3, 3, 0)
#define WWY CT_SWIZZLE_ID(0, 3, 3, 1)
#define WWZ CT_SWIZZLE_ID(0, 3, 3, 2)
#define WWW CT_SWIZZLE_ID(0, 3, 3, 3)
#define XXXX CT_SWIZZLE_ID(0, 0, 0, 0)
#define XXXY CT_SWIZZLE_ID(0, 0, 0, 1)
#define XXXZ CT_SWIZZLE_ID(0, 0, 0, 2)
#define XXXW CT_SWIZZLE_ID(0, 0, 0, 3)
#define XXYX CT_SWIZZLE_ID(0, 0, 1, 0)
#define XXYY CT_SWIZZLE_ID(0, 0, 1, 1)
#define XXYZ CT_SWIZZLE_ID(0, 0, 1, 2)
#define XXYW CT_SWIZZLE_ID(0, 0, 1, 3)
#define XXZX CT_SWIZZLE_ID(0, 0, 2, 0)
#define XXZY CT_SWIZZLE_ID(0, 0, 2, 1)
#define XXZZ CT_SWIZZLE_ID(0, 0, 2, 2)
#define XXZW CT_SWIZZLE_ID(0, 0, 2, 3)
#define XXWX CT_SWIZZLE_ID(0, 0, 3, 0)
#define XXWY CT_SWIZZLE_ID(0, 0, 3, 1)
#define XXWZ CT_SWIZZLE_ID(0, 0, 3, 2)
#define XXWW CT_SWIZZLE_ID(0, 0, 3, 3)
#define XYXX CT_SWIZZLE_ID(0, 1, 0, 0)
#define XYXY CT_SWIZZLE_ID(0, 1, 0, 1)
#define XYXZ CT_SWIZZLE_ID(0, 1, 0, 2)
#define XYXW CT_SWIZZLE_ID(0, 1, 0, 3)
#define XYYX CT_SWIZZLE_ID(0, 1, 1, 0)
#define XYYY CT_SWIZZLE_ID(0, 1, 1, 1)
#define XYYZ CT_SWIZZLE_ID(0, 1, 1, 2)
#define XYYW CT_SWIZZLE_ID(0, 1, 1, 3)
#define XYZX CT_SWIZZLE_ID(0, 1, 2, 0)
#define XYZY CT_SWIZZLE_ID(0, 1, 2, 1)
#define XYZZ CT_SWIZZLE_ID(0, 1, 2, 2)
#define XYZW CT_SWIZZLE_ID(0, 1, 2, 3)
#define XYWX CT_SWIZZLE_ID(0, 1, 3, 0)
#define XYWY CT_SWIZZLE_ID(0, 1, 3, 1)
#define XYWZ CT_SWIZZLE_ID(0, 1, 3, 2)
#define XYWW CT_SWIZZLE_ID(0, 1, 3, 3)
#define XZXX CT_SWIZZLE_ID(0, 2, 0, 0)
#define XZXY CT_SWIZZLE_ID(0, 2, 0, 1)
#define XZXZ CT_SWIZZLE_ID(0, 2, 0, 2)
#define XZXW CT_SWIZZLE_ID(0, 2, 0, 3)
#define XZYX CT_SWIZZLE_ID(0, 2, 1, 0)
#define XZYY CT_SWIZZLE_ID(0, 2, 1, 1)
#define XZYZ CT_SWIZZLE_ID(0, 2, 1, 2)
#define XZYW CT_SWIZZLE_ID(0, 2, 1, 3)
#define XZZX CT_SWIZZLE_ID(0, 2, 2, 0)
#define XZZY CT_SWIZZLE_ID(0, 2, 2, 1)
#define XZZZ CT_SWIZZLE_ID(0, 2, 2, 2)
#define XZZW CT_SWIZZLE_ID(0, 2, 2, 3)
#define XZWX CT_SWIZZLE_ID(0, 2, 3, 0)
#define XZWY CT_SWIZZLE_ID(0, 2, 3, 1)
#define XZWZ CT_SWIZZLE_ID(0, 2, 3, 2)
#define XZWW CT_SWIZZLE_ID(0, 2, 3, 3)
#define XWXX CT_SWIZZLE_ID(0, 3, 0, 0)
#define XWXY CT_SWIZZLE_ID(0, 3, 0, 1)
#define XWXZ CT_SWIZZLE_ID(0, 3, 0, 2)
#define XWXW CT_SWIZZLE_ID(0, 3, 0, 3)
#define XWYX CT_SWIZZLE_ID(0, 3, 1, 0)
#define XWYY CT_SWIZZLE_ID(0, 3, 1, 1)
#define XWYZ CT_SWIZZLE_ID(0, 3, 1, 2)
#define XWYW CT_SWIZZLE_ID(0, 3, 1, 3)
#define XWZX CT_SWIZZLE_ID(0, 3, 2, 0)
#define XWZY CT_SWIZZLE_ID(0, 3, 2, 1)
#define XWZZ CT_SWIZZLE_ID(0, 3, 2, 2)
#define XWZW CT_SWIZZLE_ID(0, 3, 2, 3)
#define XWWX CT_SWIZZLE_ID(0, 3, 3, 0)
#define XWWY CT_SWIZZLE_ID(0, 3, 3, 1)
#define XWWZ CT_SWIZZLE_ID(0, 3, 3, 2)
#define XWWW CT_SWIZZLE_ID(0, 3, 3, 3)
#define YXXX CT_SWIZZLE_ID(1, 0, 0, 0)
#define YXXY CT_SWIZZLE_ID(1, 0, 0, 1)
#define YXXZ CT_SWIZZLE_ID(1, 0, 0, 2)
#define YXXW CT_SWIZZLE_ID(1, 0, 0, 3)
#define YXYX CT_SWIZZLE_ID(1, 0, 1, 0)
#define YXYY CT_SWIZZLE_ID(1, 0, 1, 1)
#define YXYZ CT_SWIZZLE_ID(1, 0, 1, 2)
#define YXYW CT_SWIZZLE_ID(1, 0, 1, 3)
#define YXZX CT_SWIZZLE_ID(1, 0, 2, 0)
#define YXZY CT_SWIZZLE_ID(1, 0, 2, 1)
#define YXZZ CT_SWIZZLE_ID(1, 0, 2, 2)
#define YXZW CT_SWIZZLE_ID(1, 0, 2, 3)
#define YXWX CT_SWIZZLE_ID(1, 0, 3, 0)
#define YXWY CT_SWIZZLE_ID(1, 0, 3, 1)
#define YXWZ CT_SWIZZLE_ID(1, 0, 3, 2)
#define YXWW CT_SWIZZLE_ID(1, 0, 3, 3)
#define YYXX CT_SWIZZLE_ID(1, 1, 0, 0)
#define YYXY CT_SWIZZLE_ID(1, 1, 0, 1)
#define YYXZ CT_SWIZZLE_ID(1, 1, 0, 2)
#define YYXW CT_SWIZZLE_ID(1, 1, 0, 3)
#define YYYX CT_SWIZZLE_ID(1, 1, 1, 0)
#define YYYY CT_SWIZZLE_ID(1, 1, 1, 1)
#define YYYZ CT_SWIZZLE_ID(1, 1, 1, 2)
#define YYYW CT_SWIZZLE_ID(1, 1, 1, 3)
#define YYZX CT_SWIZZLE_ID(1, 1, 2, 0)
#define YYZY CT_SWIZZLE_ID(1, 1, 2, 1)
#define YYZZ CT_SWIZZLE_ID(1, 1, 2, 2)
#define YYZW CT_SWIZZLE_ID(1, 1, 2, 3)
#define YYWX CT_SWIZZLE_ID(1, 1, 3, 0)
#define YYWY CT_SWIZZLE_ID(1, 1, 3, 1)
#define YYWZ CT_SWIZZLE_ID(1, 1, 3, 2)
#define YYWW CT_SWIZZLE_ID(1, 1, 3, 3)
#define YZXX CT_SWIZZLE_ID(1, 2, 0, 0)
#define YZXY CT_SWIZZLE_ID(1, 2, 0, 1)
#define YZXZ CT_SWIZZLE_ID(1, 2, 0, 2)
#define YZXW CT_SWIZZLE_ID(1, 2, 0, 3)
#define YZYX CT_SWIZZLE_ID(1, 2, 1, 0)
#define YZYY CT_SWIZZLE_ID(1, 2, 1, 1)
#define YZYZ CT_SWIZZLE_ID(1, 2, 1, 2)
#define YZYW CT_SWIZZLE_ID(1, 2, 1, 3)
#define YZZX CT_SWIZZLE_ID(1, 2, 2, 0)
#define YZZY CT_SWIZZLE_ID(1, 2, 2, 1)
#define YZZZ CT_SWIZZLE_ID(1, 2, 2, 2)
#define YZZW CT_SWIZZLE_ID(1, 2, 2, 3)
#define YZWX CT_SWIZZLE_ID(1, 2, 3, 0)
#define YZWY CT_SWIZZLE_ID(1, 2, 3, 1)
#define YZWZ CT_SWIZZLE_ID(1, 2, 3, 2)
#define YZWW CT_SWIZZLE_ID(1, 2, 3, 3)
#define YWXX CT_SWIZZLE_ID(1, 3, 0, 0)
#define YWXY CT_SWIZZLE_ID(1, 3, 0, 1)
#define YWXZ CT_SWIZZLE_ID(1, 3, 0, 2)
#define YWXW CT_SWIZZLE_ID(1, 3, 0, 3)
#define YWYX CT_SWIZZLE_ID(1, 3, 1, 0)
#define YWYY CT_SWIZZLE_ID(1, 3, 1, 1)
#define YWYZ CT_SWIZZLE_ID(1, 3, 1, 2)
#define YWYW CT_SWIZZLE_ID(1, 3, 1, 3)
#define YWZX CT_SWIZZLE_ID(1, 3, 2, 0)
#define YWZY CT_SWIZZLE_ID(1, 3, 2, 1)
#define YWZZ CT_SWIZZLE_ID(1, 3, 2, 2)
#define YWZW CT_SWIZZLE_ID(1, 3, 2, 3)
#define YWWX CT_SWIZZLE_ID(1, 3, 3, 0)
#define YWWY CT_SWIZZLE_ID(1, 3, 3, 1)
#define YWWZ CT_SWIZZLE_ID(1, 3, 3, 2)
#define YWWW CT_SWIZZLE_ID(1, 3, 3, 3)
#define ZXXX CT_SWIZZLE_ID(2, 0, 0, 0)
#define ZXXY CT_SWIZZLE_ID(2, 0, 0, 1)
#define ZXXZ CT_SWIZZLE_ID(2, 0, 0, 2)
#define ZXXW CT_SWIZZLE_ID(2, 0, 0, 3)
#define ZXYX CT_SWIZZLE_ID(2, 0, 1, 0)
#define ZXYY CT_SWIZZLE_ID(2, 0, 1, 1)
#define ZXYZ CT_SWIZZLE_ID(2, 0, 1, 2)
#define ZXYW CT_SWIZZLE_ID(2, 0, 1, 3)
#define ZXZX CT_SWIZZLE_ID(2, 0, 2, 0)
#define ZXZY CT_SWIZZLE_ID(2, 0, 2, 1)
#define ZXZZ CT_SWIZZLE_ID(2, 0, 2, 2)
#define ZXZW CT_SWIZZLE_ID(2, 0, 2, 3)
#define ZXWX CT_SWIZZLE_ID(2, 0, 3, 0)
#define ZXWY CT_SWIZZLE_ID(2, 0, 3, 1)
#define ZXWZ CT_SWIZZLE_ID(2, 0, 3, 2)
#define ZXWW CT_SWIZZLE_ID(2, 0, 3, 3)
#define ZYXX CT_SWIZZLE_ID(2, 1, 0, 0)
#define ZYXY CT_SWIZZLE_ID(2, 1, 0, 1)
#define ZYXZ CT_SWIZZLE_ID(2, 1, 0, 2)
#define ZYXW CT_SWIZZLE_ID(2, 1, 0, 3)
#define ZYYX CT_SWIZZLE_ID(2, 1, 1, 0)
#define ZYYY CT_SWIZZLE_ID(2, 1, 1, 1)
#define ZYYZ CT_SWIZZLE_ID(2, 1, 1, 2)
#define ZYYW CT_SWIZZLE_ID(2, 1, 1, 3)
#define ZYZX CT_SWIZZLE_ID(2, 1, 2, 0)
#define ZYZY CT_SWIZZLE_ID(2, 1, 2, 1)
#define ZYZZ CT_SWIZZLE_ID(2, 1, 2, 2)
#define ZYZW CT_SWIZZLE_ID(2, 1, 2, 3)
#define ZYWX CT_SWIZZLE_ID(2, 1, 3, 0)
#define ZYWY CT_SWIZZLE_ID(2, 1, 3, 1)
#define ZYWZ CT_SWIZZLE_ID(2, 1, 3, 2)
#define ZYWW CT_SWIZZLE_ID(2, 1, 3, 3)
#define ZZXX CT_SWIZZLE_ID(2, 2, 0, 0)
#define ZZXY CT_SWIZZLE_ID(2, 2, 0, 1)
#define ZZXZ CT_SWIZZLE_ID(2, 2, 0, 2)
#define ZZXW CT_SWIZZLE_ID(2, 2, 0, 3)
#define ZZYX CT_SWIZZLE_ID(2, 2, 1, 0)
#define ZZYY CT_SWIZZLE_ID(2, 2, 1, 1)
#define ZZYZ CT_SWIZZLE_ID(2, 2, 1, 2)
#define ZZYW CT_SWIZZLE_ID(2, 2, 1, 3)
#define ZZZX CT_SWIZZLE_ID(2, 2, 2, 0)
#define ZZZY CT_SWIZZLE_ID(2, 2, 2, 1)
#define ZZZZ CT_SWIZZLE_ID(2, 2, 2, 2)
#define ZZZW CT_SWIZZLE_ID(2, 2, 2, 3)
#define ZZWX CT_SWIZZLE_ID(2, 2, 3, 0)
#define ZZWY CT_SWIZZLE_ID(2, 2, 3, 1)
#define ZZWZ CT_SWIZZLE_ID(2, 2, 3, 2)
#define ZZWW CT_SWIZZLE_ID(2, 2, 3, 3)
#define ZWXX CT_SWIZZLE_ID(2, 3, 0, 0)
#define ZWXY CT_SWIZZLE_ID(2, 3, 0, 1)
#define ZWXZ CT_SWIZZLE_ID(2, 3, 0, 2)
#define ZWXW CT_SWIZZLE_ID(2, 3, 0, 3)
#define ZWYX CT_SWIZZLE_ID(2, 3, 1, 0)
#define ZWYY CT_SWIZZLE_ID(2, 3, 1, 1)
#define ZWYZ CT_SWIZZLE_ID(2, 3, 1, 2)
#define ZWYW CT_SWIZZLE_ID(2, 3, 1, 3)
#define ZWZX CT_SWIZZLE_ID(2, 3, 2, 0)
#define ZWZY CT_SWIZZLE_ID(2, 3, 2, 1)
#define ZWZZ CT_SWIZZLE_ID(2, 3, 2, 2)
#define ZWZW CT_SWIZZLE_ID(2, 3, 2, 3)
#define ZWWX CT_SWIZZLE_ID(2, 3, 3, 0)
#define ZWWY CT_SWIZZLE_ID(2, 3, 3, 1)
#define ZWWZ CT_SWIZZLE_ID(2, 3, 3, 2)
#define ZWWW CT_SWIZZLE_ID(2, 3, 3, 3)
#define WXXX CT_SWIZZLE_ID(3, 0, 0, 0)
#define WXXY CT_SWIZZLE_ID(3, 0, 0, 1)
#define WXXZ CT_SWIZZLE_ID(3, 0, 0, 2)
#define WXXW CT_SWIZZLE_ID(3, 0, 0, 3)
#define WXYX CT_SWIZZLE_ID(3, 0, 1, 0)
#define WXYY CT_SWIZZLE_ID(3, 0, 1, 1)
#define WXYZ CT_SWIZZLE_ID(3, 0, 1, 2)
#define WXYW CT_SWIZZLE_ID(3, 0, 1, 3)
#define WXZX CT_SWIZZLE_ID(3, 0, 2, 0)
#define WXZY CT_SWIZZLE_ID(3, 0, 2, 1)
#define WXZZ CT_SWIZZLE_ID(3, 0, 2, 2)
#define WXZW CT_SWIZZLE_ID(3, 0, 2, 3)
#define WXWX CT_SWIZZLE_ID(3, 0, 3, 0)
#define WXWY CT_SWIZZLE_ID(3, 0, 3, 1)
#define WXWZ CT_SWIZZLE_ID(3, 0, 3, 2)
#define WXWW CT_SWIZZLE_ID(3, 0, 3, 3)
#define WYXX CT_SWIZZLE_ID(3, 1, 0, 0)
#define WYXY CT_SWIZZLE_ID(3, 1, 0, 1)
#define WYXZ CT_SWIZZLE_ID(3, 1, 0, 2)
#define WYXW CT_SWIZZLE_ID(3, 1, 0, 3)
#define WYYX CT_SWIZZLE_ID(3, 1, 1, 0)
#define WYYY CT_SWIZZLE_ID(3, 1, 1, 1)
#define WYYZ CT_SWIZZLE_ID(3, 1, 1, 2)
#define WYYW CT_SWIZZLE_ID(3, 1, 1, 3)
#define WYZX CT_SWIZZLE_ID(3, 1, 2, 0)
#define WYZY CT_SWIZZLE_ID(3, 1, 2, 1)
#define WYZZ CT_SWIZZLE_ID(3, 1, 2, 2)
#define WYZW CT_SWIZZLE_ID(3, 1, 2, 3)
#define WYWX CT_SWIZZLE_ID(3, 1, 3, 0)
#define WYWY CT_SWIZZLE_ID(3, 1, 3, 1)
#define WYWZ CT_SWIZZLE_ID(3, 1, 3, 2)
#define WYWW CT_SWIZZLE_ID(3, 1, 3, 3)
#define WZXX CT_SWIZZLE_ID(3, 2, 0, 0)
#define WZXY CT_SWIZZLE_ID(3, 2, 0, 1)
#define WZXZ CT_SWIZZLE_ID(3, 2, 0, 2)
#define WZXW CT_SWIZZLE_ID(3, 2, 0, 3)
#define WZYX CT_SWIZZLE_ID(3, 2, 1, 0)
#define WZYY CT_SWIZZLE_ID(3, 2, 1, 1)
#define WZYZ CT_SWIZZLE_ID(3, 2, 1, 2)
#define WZYW CT_SWIZZLE_ID(3, 2, 1, 3)
#define WZZX CT_SWIZZLE_ID(3, 2, 2, 0)
#define WZZY CT_SWIZZLE_ID(3, 2, 2, 1)
#define WZZZ CT_SWIZZLE_ID(3, 2, 2, 2)
#define WZZW CT_SWIZZLE_ID(3, 2, 2, 3)
#define WZWX CT_SWIZZLE_ID(3, 2, 3, 0)
#define WZWY CT_SWIZZLE_ID(3, 2, 3, 1)
#define WZWZ CT_SWIZZLE_ID(3, 2, 3, 2)
#define WZWW CT_SWIZZLE_ID(3, 2, 3, 3)
#define WWXX CT_SWIZZLE_ID(3, 3, 0, 0)
#define WWXY CT_SWIZZLE_ID(3, 3, 0, 1)
#define WWXZ CT_SWIZZLE_ID(3, 3, 0, 2)
#define WWXW CT_SWIZZLE_ID(3, 3, 0, 3)
#define WWYX CT_SWIZZLE_ID(3, 3, 1, 0)
#define WWYY CT_SWIZZLE_ID(3, 3, 1, 1)
#define WWYZ CT_SWIZZLE_ID(3, 3, 1, 2)
#define WWYW CT_SWIZZLE_ID(3, 3, 1, 3)
#define WWZX CT_SWIZZLE_ID(3, 3, 2, 0)
#define WWZY CT_SWIZZLE_ID(3, 3, 2, 1)
#define WWZZ CT_SWIZZLE_ID(3, 3, 2, 2)
#define WWZW CT_SWIZZLE_ID(3, 3, 2, 3)
#define WWWX CT_SWIZZLE_ID(3, 3, 3, 0)
#define WWWY CT_SWIZZLE_ID(3, 3, 3, 1)
#define WWWZ CT_SWIZZLE_ID(3, 3, 3, 2)
#define WWWW CT_SWIZZLE_ID(3, 3, 3, 3)
CT_BEGIN_DECLS
// ct_swizzle2f(ZW, a, [1,2,3,4]) => a=[3,4]
// ct_set_swizzle2f(ZY, [1,2,3,4], [10,20]) => a=[1,20,10,4]
// ct_swizzle3f(ZYW, a, [1,2,3,4]) => a=[3,2,4]
// ct_set_swizzle3f(ZYW, [1,2,3,4], [10,20,30]) => a=[1,20,10,30]
// ct_swizzle4f(ZYXX, a, [1,2,3]) => a=[3,2,1,1]
// ct_set_swizzle4f(ZYXX, [1,2,3,4], [10,20,30]) => a=[30,20,10,10]
ct_export ct_inline CT_Vec2f *ct_swizzle2f(size_t id, CT_Vec2f *a, void *b) {
float *v = (float *)b;
float x = v[CT_SWIZZLE_B(id)];
float y = v[CT_SWIZZLE_A(id)];
a->x = x;
a->y = y;
return a;
}
ct_export ct_inline void *ct_set_swizzle2f(size_t id, void *a, CT_Vec2f *b) {
float *v = (float *)a;
v[CT_SWIZZLE_B(id)] = b->x;
v[CT_SWIZZLE_A(id)] = b->y;
return a;
}
ct_export ct_inline CT_Vec3f *ct_swizzle3f(size_t id, CT_Vec3f *a, void *b) {
float *v = (float *)b;
float x = v[CT_SWIZZLE_C(id)];
float y = v[CT_SWIZZLE_B(id)];
float z = v[CT_SWIZZLE_A(id)];
a->x = x;
a->y = y;
a->z = z;
return a;
}
ct_export ct_inline void *ct_set_swizzle3f(size_t id, void *a, CT_Vec3f *b) {
float *v = (float *)a;
v[CT_SWIZZLE_C(id)] = b->x;
v[CT_SWIZZLE_B(id)] = b->y;
v[CT_SWIZZLE_A(id)] = b->z;
return a;
}
ct_export ct_inline CT_Vec4f *ct_swizzle4f(size_t id, CT_Vec4f *a, void *b) {
float *v = (float *)b;
float x = v[CT_SWIZZLE_D(id)];
float y = v[CT_SWIZZLE_C(id)];
float z = v[CT_SWIZZLE_B(id)];
float w = v[CT_SWIZZLE_A(id)];
a->x = x;
a->y = y;
a->z = z;
a->w = w;
return a;
}
ct_export ct_inline void *ct_set_swizzle4f(size_t id, void *a, CT_Vec4f *b) {
float *v = (float *)a;
v[CT_SWIZZLE_D(id)] = b->x;
v[CT_SWIZZLE_C(id)] = b->y;
v[CT_SWIZZLE_B(id)] = b->z;
v[CT_SWIZZLE_A(id)] = b->w;
return a;
}
CT_END_DECLS