v / vlib / v2 / gen / arm64 / tests / large_struct_array_field.v
36 lines · 33 sloc · 548 bytes · e7738c112c787d477501fa4a87edd0e1d72159bd
Raw
1module main
2
3struct TypeShape {
4 kind int
5 width int
6 elem_type int
7 len int
8 fields []int
9 field_names []string
10 params []int
11 ret_type int
12 is_c_struct bool
13 is_union bool
14 is_unsigned bool
15}
16
17fn fixed_array_size(types []TypeShape, typ_id int) int {
18 typ := types[typ_id]
19 if typ.kind == 4 {
20 return typ.len * 4
21 }
22 return 0
23}
24
25fn main() {
26 types := [
27 TypeShape{
28 kind: 4
29 elem_type: 1
30 len: 128
31 fields: []int{}
32 params: []int{}
33 },
34 ]
35 println(fixed_array_size(types, 0))
36}
37