bins.h raw
1 // SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense
2
3 // Code auto-generated by piet-gpu-derive
4
5 struct BinInstanceRef {
6 uint offset;
7 };
8
9 struct BinInstance {
10 uint element_ix;
11 };
12
13 #define BinInstance_size 4
14
15 BinInstanceRef BinInstance_index(BinInstanceRef ref, uint index) {
16 return BinInstanceRef(ref.offset + index * BinInstance_size);
17 }
18
19 BinInstance BinInstance_read(Alloc a, BinInstanceRef ref) {
20 uint ix = ref.offset >> 2;
21 uint raw0 = read_mem(a, ix + 0);
22 BinInstance s;
23 s.element_ix = raw0;
24 return s;
25 }
26
27 void BinInstance_write(Alloc a, BinInstanceRef ref, BinInstance s) {
28 uint ix = ref.offset >> 2;
29 write_mem(a, ix + 0, s.element_ix);
30 }
31
32